Macrometa Source for extracting data from Snowflake
Project description
macrometa-source-snowflake
A macrometa source that extracts data from a Snowflake database and produces JSON-formatted data following the Singer spec.
How to use it
TODO: Add proper context If you want to run this macrometa-source-snowflake connector independently please read further.
Install and Run
First, make sure Python 3 is installed on your system or follow these installation instructions for Mac or Ubuntu. It's recommended to use a virtualenv:
make venv
Configuration
- Create a
config.json
file with connection details to snowflake, here is a sample config file. Note:table
is a mandatory parameter as well to avoid a long-running catalog discovery process. Please specify fully qualified table and view names and only that ones that you need to extract otherwise you can end up with very long running discovery mode of this source connector. Discovery mode is analysing table structures but Snowflake doesn't like selecting lot of rows fromINFORMATION_SCHEMA
or runningSHOW
commands that returns lot of rows. Please be as specific as possible. - Run it in discovery mode to generate a
properties.json
- Edit the
properties.json
and select the streams to replicate - Run the source connector like any other singer compatible tap:
macrometa-source-snowflake --config config.json --properties properties.json --state state.json
Authentication Methods
You can either use basic user/password authentication or Key Pair authentication.
User / Password authentication
Populate user
and password
in the config.json
file
Key Pair authentication
To use key pair authentication, omit the password
and instead provide the private_key_path
to the unencrypted version of the private key and, optionally, the private_key_passphrase
.
Discovery mode
The macrometa-source-snowflake connector can be invoked in discovery mode to find the available table and columns in the database:
$ macrometa-source-snowflake --config config.json --discover
A discovered catalog is output, with a JSON-schema description of each table. A source table directly corresponds to a Singer stream.
Replication methods
The two ways to replicate a given table are FULL_TABLE
and INCREMENTAL
.
Full Table
Full-table replication extracts all data from the source table each time the connector is invoked.
Incremental
Incremental replication works in conjunction with a state file to only extract new records each time the connector is invoked. This requires a replication key to be specified in the table's metadata as well.
To run tests:
- Define environment variables that requires running the tests
export MACROMETA_SOURCE_SNOWFLAKE_ACCOUNT=<snowflake-account-name>
export MACROMETA_SOURCE_SNOWFLAKE_DBNAME=<snowflake-database-name>
export MACROMETA_SOURCE_SNOWFLAKE_USER=<snowflake-user>
export MACROMETA_SOURCE_SNOWFLAKE_PASSWORD=<snowflake-password>
export MACROMETA_SOURCE_SNOWFLAKE_PRIVATE_KEY_PATH=<snowflake-pk-path>
export MACROMETA_SOURCE_SNOWFLAKE_PRIVATE_KEY_PASSPHRASE=<snowflake-passphrase>
export MACROMETA_SOURCE_SNOWFLAKE_WAREHOUSE=<snowflake-warehouse>
- Install python dependencies
make venv
- To run unit tests: PS: There are no unit tests at the time of writing this document
make unit_test
- To run Integration tests
make integration_test
To run formatting and linting:
make venv format pylint
License
Apache License Version 2.0 See LICENSE to see the full text.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for macrometa-source-snowflake-0.0.42.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d80cba0278d165ecf4890e06077ab1c35c34314bba3e5c44f794faf98c0758e |
|
MD5 | 622251a9d91e0991bab9c6fde41f662a |
|
BLAKE2b-256 | a9a9ce2981b285137388c017e4145d41871b57c8b9236037ca9cf46e9f4bf37b |
Hashes for macrometa_source_snowflake-0.0.42-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1a93384c9bac87d48c896bc61e27bc6146385d630b02a505c3769b912839b56 |
|
MD5 | f565c250ca6140c03435bfc0f7c4d160 |
|
BLAKE2b-256 | fe111fdb2c1d845404f824e11ee33dfbf509fb4fb7984c8d582bd2e50262d652 |