def _partitioned_by(self): if self.partition is not None: return 'PARTITIONED BY ({})'.format( ', '.join( quote_identifier(expr._name) for expr in self.partition ) ) return None
def compile(self): name = quote_identifier(self.name) create_decl = 'CREATE DATABASE' create_line = '{} {}{}'.format(create_decl, self._if_exists(), name) if self.path is not None: create_line += "\nLOCATION '{}'".format(self.path) return create_line
def _table_column(translator, expr): op = expr.op() field_name = op.name quoted_name = quote_identifier(field_name, force=True) table = op.table ctx = translator.context # If the column does not originate from the table set in the current SELECT # context, we should format as a subquery if translator.permit_subquery and ctx.is_foreign_expr(table): proj_expr = table.projection([field_name]).to_array() return _table_array_view(translator, proj_expr) if ctx.need_aliases(): alias = ctx.get_ref(table) if alias is not None: quoted_name = '{}.{}'.format(alias, quoted_name) return quoted_name
def _quote_identifier(self, name): return quote_identifier(name)
def _format_schema_element(name, t): return '{} {}'.format( quote_identifier(name, force=True), type_to_sql_string(t), )
def name(self, translated, name, force=True): """Return expression with its identifier.""" return self._name_expr(translated, quote_identifier(name, force=force))