def convert(ctx, table, s3_path): engine = get_sa_engine(ctx) sa_table = SqlAlchemySchemaReader(engine).get_table_schema(table) s3_config = SimpleS3Config.from_base_path(s3_path) converter = ConcurrentManifestConverter(sa_table, s3_config) converter.convert_manifest()
def transform(ctx, table, s3_path, dest_schema, dest_table, s3_region): dest_table = dest_table or table engine = get_sa_engine(ctx) s3_config = SimpleS3Config.from_base_path(s3_path, region=s3_region) transformer = TableTransformer(engine, table, s3_config, dest_schema, dest_table) transformer.transform()
def create_table(ctx, s3_path, source_table, dest_table, dest_schema): click.echo('Create Spectrum table') engine = get_sa_engine(ctx) sa_table = SqlAlchemySchemaReader(engine).get_table_schema(source_table) s3_config = SimpleS3Config.from_base_path(s3_path) table_creator = SpectrumTableCreator(engine, dest_schema, dest_table, sa_table, s3_config) table_creator.log_query() table_creator.confirm() table_creator.create()
def export(ctx, table, s3_path, s3_region): engine = get_sa_engine(ctx) s3_config = SimpleS3Config.from_base_path(s3_path, region=s3_region) RedshiftDataExporter(engine, s3_config).export_to_csv(table)