splitgraph.ingestion.snowflake package

Module contents

class splitgraph.ingestion.snowflake.SnowflakeDataSource(engine: PostgresEngine, credentials: Optional[Dict[str, Any]] = None, params: Optional[Dict[str, Any]] = None)

Bases: splitgraph.hooks.data_source.fdw.ForeignDataWrapperDataSource

commandline_help: str = 'Mount a Snowflake database.\n    \nThis will mount a remote Snowflake schema or a table. You can also get a mounted table to point to the result of a subquery that will be executed on the Snowflake instance. For example:\n\n\x08\n```\n$ sgr mount snowflake test_snowflake -o@- <<EOF\n&lbrace;\n    "username": "username",\n    "password": "password",\n    "account": "acc-id.west-europe.azure",\n    "database": "SNOWFLAKE_SAMPLE_DATA",\n    "schema": "TPCH_SF100"\n&rbrace;\nEOF\n\n$ sgr mount snowflake test_snowflake_subquery -o@- <<EOF\n&lbrace;\n    "username": "username",\n    "password": "password",\n    "account": "acc-id.west-europe.azure",\n    "database": "SNOWFLAKE_SAMPLE_DATA",\n    "tables": &lbrace;\n        "balances": &lbrace;\n            "schema": &lbrace;\n                "n_nation": "varchar",\n                "segment": "varchar",\n                "avg_balance": "numeric"\n            &rbrace;,\n            "options": &lbrace;\n                "subquery": "SELECT n_nation AS nation, c_mktsegment AS segment, AVG(c_acctbal) AS avg_balance FROM TPCH_SF100.customer c JOIN TPCH_SF100.nation n ON c_nationkey = n_nationkey"\n            &rbrace;\n        &rbrace;\n    &rbrace;\n&rbrace;\nEOF\n```\n    '
commandline_kwargs_help: str = 'username: Username. Required.\npassword: Password. Required.\naccount: Account Locator, e.g. xy12345.us-east-2.aws. For more information, see https://docs.snowflake.com/en/user-guide/connecting.html. Required.\ntables: Tables to mount (default all). If a list, will import only these tables. \nIf a dictionary, must have the format\n    &lbrace;"table_name": &lbrace;"schema": &lbrace;"col_1": "type_1", ...&rbrace;,\n                    "options": &lbrace;[get passed to CREATE FOREIGN TABLE]&rbrace;&rbrace;&rbrace;.\ndatabase: Snowflake database name. Required.\nschema: Snowflake schema.\nwarehouse: Warehouse name.\nrole: Role.\nThe schema parameter is required when subquery isn\'t used.'
credentials_schema: Dict[str, Any] = &lbrace;'properties': &lbrace;'account': &lbrace;'description': 'Account Locator, e.g. xy12345.us-east-2.aws. For more information, see https://docs.snowflake.com/en/user-guide/connecting.html', 'type': 'string'&rbrace;, 'password': &lbrace;'description': 'Password', 'type': 'string'&rbrace;, 'username': &lbrace;'description': 'Username', 'type': 'string'&rbrace;&rbrace;, 'required': ['username', 'password', 'account'], 'type': 'object'&rbrace;
classmethod get_description()str
get_fdw_name()
classmethod get_name()str
get_remote_schema_name()str

Override this if the FDW supports IMPORT FOREIGN SCHEMA

get_server_options()
get_table_options(table_name: str)Mapping[str, str]
params_schema: Dict[str, Any] = &lbrace;'properties': &lbrace;'database': &lbrace;'description': 'Snowflake database name', 'type': 'string'&rbrace;, 'role': &lbrace;'description': 'Role', 'type': 'string'&rbrace;, 'schema': &lbrace;'description': 'Snowflake schema', 'type': 'string'&rbrace;, 'tables': &lbrace;'additionalProperties': &lbrace;'options': &lbrace;'additionalProperties': &lbrace;'type': 'string'&rbrace;, 'type': 'object'&rbrace;&rbrace;, 'type': 'object'&rbrace;, 'warehouse': &lbrace;'description': 'Warehouse name', 'type': 'string'&rbrace;&rbrace;, 'required': ['database'], 'type': 'object'&rbrace;
supports_load = True
supports_mount = True
supports_sync = False