
Show HN: Redshift to Snowflake – Python - jimmylowell
https://github.com/jimmylowell/rs_to_sf
======
jimmylowell
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](https://github.com/jimmylowell/rs_to_sf)

This would not be possible without:

[https://github.com/awslabs/amazon-redshift-
utils/blob/master...](https://github.com/awslabs/amazon-redshift-
utils/blob/master/src/AdminViews/v_generate_tbl_ddl.sql)

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

~~~
jimmylowell
Blog post with more writing...
[https://myjimmyweb.com/index.php/2020/02/05/redshift-to-
snow...](https://myjimmyweb.com/index.php/2020/02/05/redshift-to-snowflake-
python/)

