def upload_schema(self, db, table, tmp_dir_db):
""" Upload the schema of a table to s3
Args:
db - the db to be backed up
table - the table to be backed up
tmp_dir_db - temporary storage used for all tables in the db
"""
(schema_path, _, _) = get_csv_backup_paths(
self.datestamp, db, table, self.instance.replica_type,
self.instance.get_zk_replica_set()[0])
create_stm = show_create_table(self.instance, db, table)
log.debug('{proc_id}: Uploading schema to {schema_path}'
''.format(
schema_path=schema_path,
proc_id=multiprocessing.current_process().name))
boto_conn = boto.connect_s3()
bucket = boto_conn.get_bucket(S3_CSV_BUCKET, validate=False)
key = bucket.new_key(schema_path)
key.set_contents_from_string(create_stm)
评论列表
文章目录