memsql / dbt-singlestore

Apache License 2.0
7 stars 8 forks source link

Fix Incorrect Imports #26

Open brandon-braner opened 4 months ago

brandon-braner commented 4 months ago

Issue Title

When running dbt init for singlestore I get errors about incorrect imports.

Description

Using the following versions dbt-core = "^1.8.1" dbt-singlestore = "^1.6.1"

When I run dbt init and choose single store I get errors about not being able to import Credentials and AdapterResponse in connections.py and in impl.py I get errors around ColumnLevelConstraint, ConstraintType, ModelLevelConstraint and dbtClassMixin, ValidationError.

Credentials and AdapterResponse appear to have been moved to dbt.adapters.contracts.connection

Expected Behavior

When I run dbt init and choose SingleStore I expect to be able to setup the adapter

Actual Behavior I get errors around not being able to find the packages

Steps to Reproduce List the steps to reproduce the issue:

  1. pip install dbt-core 1.8.1 and dbt-singlestore 1.6.1
  2. Run dbt init
  3. Choose singlestore adapter
  4. Observe the error Error Message
Which database would you like to use?
[1] singlestore

(Don't see the one you want? https://docs.getdbt.com/docs/available-adapters)

Enter a number: 1
02:05:06  Encountered an error:
cannot import name 'Credentials' from 'dbt.adapters.base' (/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/adapters/base/__init__.py)
02:05:06  Traceback (most recent call last):
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/cli/requires.py", line 138, in wrapper
    result, success = func(*args, **kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/cli/requires.py", line 101, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/cli/main.py", line 469, in init
    results = task.run()
              ^^^^^^^^^^
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/task/init.py", line 347, in run
    self.setup_profile(profile_name)
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/task/init.py", line 263, in setup_profile
    self.create_profile_from_target(adapter, profile_name=profile_name)
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/task/init.py", line 173, in create_profile_from_target
    load_plugin(adapter)
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/adapters/factory.py", line 239, in load_plugin
    return FACTORY.load_plugin(name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/adapters/factory.py", line 68, in load_plugin
    mod: Any = import_module("." + name, "dbt.adapters")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/brandonbraner/.asdf/installs/python/3.12.0/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/adapters/singlestore/__init__.py", line 1, in <module>
    from dbt.adapters.singlestore.connections import SingleStoreConnectionManager
  File "/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/adapters/singlestore/connections.py", line 12, in <module>
    from dbt.adapters.base import Credentials
ImportError: cannot import name 'Credentials' from 'dbt.adapters.base' (/Users/brandonbraner/Library/Caches/pypoetry/virtualenvs/dbt-error-TwLcWqDh-py3.12/lib/python3.12/site-packages/dbt/adapters/base/__init__.py)