Skip to content

Cannot mount Snowflake as a data source behind a proxy #413

@mapshen

Description

@mapshen

We are evaluating splitgraph in our corporate env, where we have to go through a proxy to reach Snowflake.

When we do

sgr --version
sgr, version 0.2.10
sgr -v DEBUG mount snowflake test_snowflake -o@- <<EOF
heredoc> {
heredoc>     "username": "XXX",
heredoc>     "password": "XXX",
heredoc>     "account": "XXX",
heredoc>     "database": "XXX",
heredoc>     "schema": "XXX"
heredoc> }
heredoc> EOF

we get the following error

error: Traceback (most recent call last):
error:   File "/home/XXX/python3.7/site-packages/splitgraph/commandline/__init__.py", line 116, in invoke
error:     result = super(click.Group, self).invoke(ctx)
error:   File "/home/XXX/python3.7/site-packages/click/core.py", line 1259, in invoke
error:     return _process_result(sub_ctx.command.invoke(sub_ctx))
error:   File "/home/XXX/python3.7/site-packages/click/core.py", line 1259, in invoke
error:     return _process_result(sub_ctx.command.invoke(sub_ctx))
error:   File "/home/XXX/python3.7/site-packages/click/core.py", line 1066, in invoke
error:     return ctx.invoke(self.callback, **ctx.params)
error:   File "/home/XXX/python3.7/site-packages/click/core.py", line 610, in invoke
error:     return callback(*args, **kwargs)
error:   File "/home/XXX/python3.7/site-packages/splitgraph/commandline/mount.py", line 69, in _callback
error:     mount(schema, mount_handler=handler_name, handler_kwargs=handler_options)
error:   File "/home/XXX/python3.7/site-packages/splitgraph/hooks/mount_handlers.py", line 69, in mount
error:     source.mount(schema=mountpoint, overwrite=overwrite, tables=tables)
error:   File "/home/XXX/python3.7/site-packages/splitgraph/hooks/data_source/fdw.py", line 134, in mount
error:     self._create_foreign_tables(schema, server_id, tables)
error:   File "/home/XXX/python3.7/site-packages/splitgraph/hooks/data_source/fdw.py", line 144, in _create_foreign_tables
error:     _import_foreign_schema(self.engine, schema, remote_schema, server_id, tables)
error:   File "/home/XXX/python3.7/site-packages/splitgraph/hooks/data_source/fdw.py", line 299, in _import_foreign_schema
error:     engine.run_sql(query)
error:   File "/home/XXX/python3.7/site-packages/splitgraph/engine/postgres/engine.py", line 501, in run_sql
error:     cur.execute(statement, _convert_vals(arguments) if arguments else None)
error: psycopg2.errors.InternalError_: Error in python: OperationalError
error: DETAIL:  (snowflake.connector.errors.OperationalError) 250003: Failed to execute request: HTTPSConnectionPool(host='XXX.snowflakecomputing.com', port=443): Max retries exceeded with url: /session/v1/login-request?request_id=XXX&databaseName=XXX&schemaName=XXX&request_guid=XXX(Caused by ConnectTimeoutError(<snowflake.connector.vendored.urllib3.connection.HTTPSConnection object at 0x7f31c8e0df98>, 'Connection to XXX.snowflakecomputing.com timed out. (connect timeout=60)'))
error: (Background on this error at: http://sqlalche.me/e/14/e3q8)

It seems although the snowflake connector Splitgraph uses supports proxy settings via HTTPS_PROXY, HTTP_PROXY and NO_PROXY [1], but it psycopg2 doesn't pass them over while creating new servers [2]?

[1] https://github.com/splitgraph/snowflake-sqlalchemy#using-a-proxy-server
[2] https://github.com/splitgraph/splitgraph/blob/3cc20ef9021c153344cb0e52247dcc9162812d50/splitgraph/hooks/data_source/fdw.py#L259

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions