Splitgraph has been acquired by EDB! Read the blog post.

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&lbrace;\n    "username": "username",\n    "password": "password",\n    "account": "acc-id.west-europe.azure",\n    "database": "SNOWFLAKE_SAMPLE_DATA",\n    "schema": "TPCH_SF100"\n    "envvars": &lbrace;"HTTPS_PROXY": "http://proxy.company.com"&rbrace;\n&rbrace;\nEOF\n\x08\n$ sgr mount snowflake test_snowflake_subquery -o@- <<EOF\n&lbrace;\n    "username": "username",\n    "private_key": "MIIEvQIBAD...",\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.\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] = &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;, 'secret': &lbrace;'oneOf': [&lbrace;'type': 'object', 'required': ['secret_type', 'password'], 'properties': &lbrace;'secret_type': &lbrace;'type': 'string', 'const': 'password'&rbrace;, 'password': &lbrace;'type': 'string', 'description': 'Password'&rbrace;&rbrace;&rbrace;, &lbrace;'type': 'object', 'required': ['secret_type', 'private_key'], 'properties': &lbrace;'secret_type': &lbrace;'type': 'string', 'const': 'private_key'&rbrace;, 'private_key': &lbrace;'type': 'string', 'description': 'Private key in PEM format'&rbrace;&rbrace;&rbrace;], 'type': 'object'&rbrace;, 'username': &lbrace;'description': 'Username', 'type': 'string'&rbrace;&rbrace;, 'required': ['username', '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, 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] = &lbrace;'properties': &lbrace;'batch_size': &lbrace;'description': 'Default fetch size for remote queries', 'type': 'integer'&rbrace;, 'database': &lbrace;'description': 'Snowflake database name', 'type': 'string'&rbrace;, 'envvars': &lbrace;'description': 'Environment variables to set on the engine side', 'type': 'object'&rbrace;, 'role': &lbrace;'description': 'Role', 'type': 'string'&rbrace;, 'schema': &lbrace;'description': 'Snowflake schema', 'type': 'string'&rbrace;, 'warehouse': &lbrace;'description': 'Warehouse name', 'type': 'string'&rbrace;&rbrace;, 'required': ['database'], 'type': 'object'&rbrace;
supports_load = True
supports_mount = True
supports_sync = False
table_params_schema: Dict[str, Any] = &lbrace;'properties': &lbrace;'subquery': &lbrace;'description': 'Subquery for this table to run on the server side', 'type': 'string'&rbrace;&rbrace;, 'type': 'object'&rbrace;