Beispiel #1
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
Beispiel #2
0
 def _quote_identifier(self, name):
     return quote_identifier(name)
Beispiel #3
0
 def name(self, translated, name, force=True):
     """Return expression with its identifier."""
     return self._name_expr(translated, quote_identifier(name, force=force))
Beispiel #4
0
def _format_schema_element(name, t):
    return '{} {}'.format(
        quote_identifier(name, force=True),
        _type_to_sql_string(t),
    )
Beispiel #5
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