3 comments

[ 3.2 ms ] story [ 16.1 ms ] thread
I’ve been writing code for a while now, but have always meant to share more. Also write once in a while...

TLDR;

I wrote some python+SQL to move data from Redshift to Snowflake:

https://github.com/jimmylowell/rs_to_sf

This would not be possible without:

https://github.com/awslabs/amazon-redshift-utils/blob/master...

I edited "v_generate_tbl_ddl.sql" to convert Redshift data types to Snowflake. The script will CREATE the table(s) in Snowflake, UNLOAD from Redshift to S3, and finish with a COPY into Snowflake.

Default values+sequences are not brought over. The SQL file has some comments on how to get them from Redshift in Snowflake format, but I (un)fortunately do not have access to a RS instance anymore for further development. When using this at my job, I would edit the SQL to get sequences first, then make sure I had the DDL to include default values. Some REGEX was involved. You could then run this script without creating table ddl and load data with table sequences and default values! I tried to include this along with several other improvements on the github page, but again, I am brand new to sharing my code. : )

Thanks for reading!

Jimmy

Nice! It would be great to have an orchestration tutorial as well