Skip to content

Instantly share code, notes, and snippets.

@afcotroneo
Last active July 11, 2022 19:25
Show Gist options
  • Save afcotroneo/85399c2ac97f9861aceec71f53c27e9b to your computer and use it in GitHub Desktop.
Save afcotroneo/85399c2ac97f9861aceec71f53c27e9b to your computer and use it in GitHub Desktop.
## Using a data source name:
COPY example_table
FROM 'SELECT * FROM remote_postgres_table WHERE event_timestamp > ''2020-01-01'';'
WITH
(source_type = 'odbc',
sql_order_by = 'event_timestamp',
data_source_name = 'postgres_db_1',
username = 'my_username',
password = 'my_password');
## Using a connection string:
COPY example_table
FROM 'SELECT * FROM remote_postgres_table WHERE event_timestamp > ''2020-01-01'';'
WITH
(source_type = 'odbc',
sql_order_by = 'event_timestamp',
connection_string = 'Driver=PostgreSQL;Database=my_postgres_db;Servername=my_postgres.example.com;Port=1234',
credential_string = 'Username=my_username;Password=my_password');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment