示例#1
0
 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
示例#2
0
    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
示例#3
0
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
示例#4
0
 def _quote_identifier(self, name):
     return quote_identifier(name)
示例#5
0
def _format_schema_element(name, t):
    return '{} {}'.format(
        quote_identifier(name, force=True), type_to_sql_string(t),
    )
示例#6
0
文件: compiler.py 项目: zbrookle/ibis
 def name(self, translated, name, force=True):
     """Return expression with its identifier."""
     return self._name_expr(translated, quote_identifier(name, force=force))