Skip to content

TypeError: Connection.__init__() got an unexpected keyword argument 'database' #222

@amotl

Description

@amotl

Problem

Already mentioned in GH-73, when trying to load data with dlt using destination=dlt.destinations.sqlalchemy("crate://crate@localhost:4200"), this exception is raised:

Traceback (most recent call last):
  File "/path/to/dlt/pipeline/pipeline.py", line 771, in _sync_destination
    remote_state = self._restore_state_from_destination()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/dlt/pipeline/pipeline.py", line 1531, in _restore_state_from_destination
    with self._get_destination_clients(schema)[0] as job_client:
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/path/to/dlt/destinations/job_client_impl.py", line 433, in __enter__
    self.sql_client.open_connection()
  File "/path/to/dlt/destinations/impl/sqlalchemy/db_api_client.py", line 139, in open_connection
    self._current_connection = self.credentials.borrow_conn()
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/dlt/destinations/impl/sqlalchemy/configuration.py", line 53, in borrow_conn
    return engine_.connect()
           ^^^^^^^^^^^^^^^^^
[...]
  File "/path/to/sqlalchemy/engine/create.py", line 646, in connect
    return dialect.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/sqlalchemy_cratedb/dialect.py", line 261, in connect
    return self.dbapi.connect(servers=servers, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Connection.__init__() got an unexpected keyword argument 'database'

Thoughts

We are aware CrateDB does not support CREATE DATABASE and friends, but maybe the SQLAlchemy dialect could be made more compliant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    pgcompatPostgreSQL compatibility and other details about standards-compliance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions