简体   繁体   English

通过阅读python中的Oracle DDL语句为Redshift创建创建表语句

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

I have 5 tables in an Oracle database. 我在Oracle数据库中有5个表。 I need to create similar structures of them in AWS Redshift. 我需要在AWS Redshift中创建类似的结构。 I am using cx_oracle to connect to Oracle and dump the ddl in a csv file. 我正在使用cx_oracle连接到Oracle并将ddl转储到csv文件中。 But changing that DDL for each datatype in python to make it run in Redshift is turning out to be a very tedious process. 但是,更改python中每个数据类型的DDL以使其在Redshift中运行,事实证明这是一个非常繁琐的过程。

Is there any easy way to do in Python? 在Python中有什么简单的方法吗? Is there any library or function to do this seamlessly. 是否有任何库或函数可以无缝地执行此操作。

PS: I tried to use AWS Schema Conversion Tool for this. PS:我尝试为此使用AWS Schema Conversion Tool。 The tables got created in Redshift, but, with a glitch. 这些表是在Redshift中创建的,但存在故障。 Every datatype got doubled in Redshift. 在Redshift中,每个数据类型都增加了一倍。

For example: varchar(100) in Oracle became varchar(200) in Redshift Has anyone faced a similar issue before with SCT? 例如:Oracle中的varchar(100)在Redshift中变成了varchar(200),是否有人在使用SCT之前遇到过类似的问题?

The cx_OracleTools project and specifically the DescribeObject tool within that project have the ability to extract the DDL from an Oracle database. cx_OracleTools项目,特别是该项目内的DescribeObject工具具有从Oracle数据库提取DDL的能力。 You may be able to use that. 您也许可以使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM