def to_ddl(self): yield 'STORED AS AVRO' yield "LOCATION '{}'".format(self.path) schema = json.dumps(self.avro_schema, indent=2, sort_keys=True) schema = '\n'.join(x.rstrip() for x in schema.splitlines()) props = {'avro.schema.literal': schema} yield format_tblproperties(props)
def to_ddl(self): yield 'ROW FORMAT DELIMITED' if self.delimiter is not None: yield "FIELDS TERMINATED BY '{}'".format(self.delimiter) if self.escapechar is not None: yield "ESCAPED BY '{}'".format(self.escapechar) if self.lineterminator is not None: yield "LINES TERMINATED BY '{}'".format(self.lineterminator) yield "LOCATION '{}'".format(self.path) if self.na_rep is not None: props = {'serialization.null.format': self.na_rep} yield format_tblproperties(props)
def compile(self): return '{}\n{} AS\n{}'.format( self._create_line(), format_tblproperties(self._get_table_properties()), self.select.compile(), )
def compile(self): return '{}\n{}\n{}'.format( self._create_line(), format_schema(self.schema), format_tblproperties(self._get_table_properties()), )