def to_ddl(self): import json buf = StringIO() buf.write('\nSTORED AS AVRO') buf.write("\nLOCATION '{0}'".format(self.path)) schema = json.dumps(self.avro_schema, indent=2, sort_keys=True) schema = '\n'.join([x.rstrip() for x in schema.split('\n')]) buf.write( "\nTBLPROPERTIES ('avro.schema.literal'='{0}')".format(schema)) return buf.getvalue()
def to_ddl(self): import json buf = BytesIO() buf.write('\nSTORED AS AVRO') buf.write("\nLOCATION '{0}'".format(self.path)) schema = json.dumps(self.avro_schema, indent=2, sort_keys=True) schema = '\n'.join([x.rstrip() for x in schema.split('\n')]) buf.write("\nTBLPROPERTIES ('avro.schema.literal'='{0}')" .format(schema)) return buf.getvalue()