splitgraph.ingestion.snowflake package
Module contents
- class splitgraph.ingestion.snowflake.SnowflakeDataSource(engine: PostgresEngine, credentials: Credentials, params: Params, tables: Optional[Union[List[str], Dict[str, Tuple[List[splitgraph.core.types.TableColumn], TableParams]]]] = 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{\n "username": "username",\n "password": "password",\n "account": "acc-id.west-europe.azure",\n "database": "SNOWFLAKE_SAMPLE_DATA",\n "schema": "TPCH_SF100"\n "envvars": {"HTTPS_PROXY": "http://proxy.company.com"}\n}\nEOF\n\x08\n$ sgr mount snowflake test_snowflake_subquery -o@- <<EOF\n{\n "username": "username",\n "private_key": "MIIEvQIBAD...",\n "account": "acc-id.west-europe.azure",\n "database": "SNOWFLAKE_SAMPLE_DATA",\n "tables": {\n "balances": {\n "schema": {\n "n_nation": "varchar",\n "segment": "varchar",\n "avg_balance": "numeric"\n },\n "options": {\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 }\n }\n }\n}\nEOF\n```\n '
- commandline_kwargs_help: str = "username: Username. Required.\nsecret:\naccount: Account Locator, e.g. xy12345.us-east-2.aws. For more information, see https://docs.snowflake.com/en/user-guide/connecting.html. Required.\ndatabase: Snowflake database name. Required.\nschema: Snowflake schema.\nwarehouse: Warehouse name.\nrole: Role.\nbatch_size: Default fetch size for remote queries.\nenvvars: Environment variables to set on the engine side.\nThe schema parameter is required when subquery isn't used."
- credentials_schema: Dict[str, Any] = {'properties': {'account': {'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'}, 'secret': {'oneOf': [{'type': 'object', 'required': ['secret_type', 'password'], 'properties': {'secret_type': {'type': 'string', 'const': 'password'}, 'password': {'type': 'string', 'description': 'Password'}}}, {'type': 'object', 'required': ['secret_type', 'private_key'], 'properties': {'secret_type': {'type': 'string', 'const': 'private_key'}, 'private_key': {'type': 'string', 'description': 'Private key in PEM format'}}}], 'type': 'object'}, 'username': {'description': 'Username', 'type': 'string'}}, 'required': ['username', 'account'], 'type': 'object'}
- 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, tables: Optional[Union[List[str], Dict[str, Tuple[List[splitgraph.core.types.TableColumn], TableParams]]]] = None) Dict[str, str]
- classmethod migrate_credentials(credentials: Credentials) Credentials
- params_schema: Dict[str, Any] = {'properties': {'batch_size': {'description': 'Default fetch size for remote queries', 'type': 'integer'}, 'database': {'description': 'Snowflake database name', 'type': 'string'}, 'envvars': {'description': 'Environment variables to set on the engine side', 'type': 'object'}, 'role': {'description': 'Role', 'type': 'string'}, 'schema': {'description': 'Snowflake schema', 'type': 'string'}, 'warehouse': {'description': 'Warehouse name', 'type': 'string'}}, 'required': ['database'], 'type': 'object'}
- supports_load = True
- supports_mount = True
- supports_sync = False
- table_params_schema: Dict[str, Any] = {'properties': {'subquery': {'description': 'Subquery for this table to run on the server side', 'type': 'string'}}, 'type': 'object'}