Skip to content

Commit

Permalink
chore(flink): quote every identifier for Flink SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman committed Nov 28, 2023
1 parent 969b9d7 commit e8e344b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 567 deletions.
6 changes: 2 additions & 4 deletions ibis/backends/base/sql/registry/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ def format_call(translator, func, *args):
return "{}({})".format(func, ", ".join(formatted_args))


def quote_identifier(
name, quotechar="`", force=False, base_identifiers=identifiers.base_identifiers
):
def quote_identifier(name, quotechar="`", force=False):
"""Add quotes to the `name` identifier if needed."""
if force or name.count(" ") or name in base_identifiers:
if force or name.count(" ") or name in identifiers.base_identifiers:
return f"{quotechar}{name}{quotechar}"
else:
return name
Expand Down
3 changes: 1 addition & 2 deletions ibis/backends/flink/compiler/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
TableSetFormatter,
)
from ibis.backends.base.sql.registry import quote_identifier
from ibis.backends.flink import identifiers
from ibis.backends.flink.translator import FlinkExprTranslator


class FlinkTableSetFormatter(TableSetFormatter):
def _quote_identifier(self, name):
return quote_identifier(name, base_identifiers=identifiers.base_identifiers)
return quote_identifier(name, force=True)

def _format_in_memory_table(self, op):
names = op.schema.names
Expand Down
Loading

0 comments on commit e8e344b

Please sign in to comment.