Sourav Gupta
Sourav Gupta

Reputation: 257

Creating Create Table statements for Redshift by reading Oracle DDL statement in python

I have 5 tables in an Oracle database. I need to create similar structures of them in AWS Redshift. I am using cx_oracle to connect to Oracle and dump the ddl in a csv file. But changing that DDL for each datatype in python to make it run in Redshift is turning out to be a very tedious process.

Is there any easy way to do in Python? Is there any library or function to do this seamlessly.

PS: I tried to use AWS Schema Conversion Tool for this. The tables got created in Redshift, but, with a glitch. Every datatype got doubled in Redshift.

For example: varchar(100) in Oracle became varchar(200) in Redshift Has anyone faced a similar issue before with SCT?

Upvotes: 0

Views: 478

Answers (1)

Anthony Tuininga
Anthony Tuininga

Reputation: 7086

The cx_OracleTools project and specifically the DescribeObject tool within that project have the ability to extract the DDL from an Oracle database. You may be able to use that.

Upvotes: 1

Related Questions