Created
May 21, 2014 08:37
-
-
Save marinbek/eff0414237a512724504 to your computer and use it in GitHub Desktop.
unload & copy redshift data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT 'UNLOAD (\'select * from '||n.nspname ||'.'|| c.relname||'\') TO \'s3://bucket/' || c.relname || '_\';' as "Name" | |
FROM pg_catalog.pg_class c | |
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
WHERE c.relkind IN ('r','v','S','') | |
AND n.nspname LIKE 'nu_alibris'; | |
SELECT 'COPY ' || n.nspname ||'.'|| c.relname ||' from \'s3://bucket/' || c.relname || '_\';' as "Name" | |
FROM pg_catalog.pg_class c | |
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
WHERE c.relkind IN ('r','v','S','') | |
AND n.nspname LIKE 'nu_alibris_qa'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment