(dbt-teradata 1.8.0) TypeError: TeradataAdapter.get_catalog() takes 2 positional arguments but 3 were given
rafaelkrysciak opened this issue · 2 comments
Describe the bug
When calling dbt docs generate
, the get_catalog
method is called. dbt-core expects the method to take three positional parameters (self, relation_configs, used_schemas), but the implementation takes just two (self, manifest). This causes the command to fail with the following traceback:
06:46:58 Building catalog
06:46:58 Encountered an error:
TeradataAdapter.get_catalog() takes 2 positional arguments but 3 were given
06:46:58 Traceback (most recent call last):
File "C:\Users\Max\Documents\GitHub\dbt\project1\venv\Lib\site-packages\dbt\cli\requires.py", line 138, in wrapper
result, success = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Max\Documents\GitHub\dbt\project1\venv\Lib\site-packages\dbt\cli\requires.py", line 101, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Max\Documents\GitHub\dbt\project1\venv\Lib\site-packages\dbt\cli\requires.py", line 218, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Max\Documents\GitHub\dbt\project1\venv\Lib\site-packages\dbt\cli\requires.py", line 247, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Max\Documents\GitHub\dbt\project1\venv\Lib\site-packages\dbt\cli\requires.py", line 294, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Max\Documents\GitHub\dbt\project1\venv\Lib\site-packages\dbt\cli\requires.py", line 332, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Max\Documents\GitHub\dbt\project1\venv\Lib\site-packages\dbt\cli\main.py", line 273, in docs_generate
results = task.run()
^^^^^^^^^^
File "C:\Users\Max\Documents\GitHub\dbt\project1\venv\Lib\site-packages\dbt\task\docs\generate.py", line 290, in run
catalog_table, exceptions = adapter.get_filtered_catalog(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Max\Documents\GitHub\dbt\project1\venv\Lib\site-packages\dbt\adapters\base\impl.py", line 1191, in get_filtered_catalog
catalogs, exceptions = self.get_catalog(relation_configs, used_schemas)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: TeradataAdapter.get_catalog() takes 2 positional arguments but 3 were given
This applies to cbt-core 1.8.3 as well as to 1.8.0.
Steps To Reproduce
Execute the dbt docs generate
command.
Expected behavior
The command dbt docs generate
executes without errors.
The output of dbt --version
:
Core:
- installed: 1.8.3
- latest: 1.8.3 - Up to date!
Plugins:
- teradata: 1.8.0 - Up to date!
The operating system you're using:
Windows 11
The output of python --version
:
Python 3.11.3
I tried to reproduce the issue.
But the dbt docs generate
is working for me
C:\dbt-teradata\jaffle_shop\jaffle_shop>dbt docs generate
07:58:31 Running with dbt=1.8.3
07:58:31 Registered adapter: teradata=1.8.0
07:58:33 Found 8 models, 1 snapshot, 3 seeds, 20 data tests, 442 macros
07:58:33
07:58:43 teradata adapter: Query Band set to ['=S> org=teradata-internal-telem;appname=dbt;']
07:58:48 teradata adapter: Query Band set to ['=S> org=teradata-internal-telem;appname=dbt;']
07:58:49 Concurrency: 1 threads (target='dev')
07:58:49
07:58:50 Building catalog
07:58:54 teradata adapter: Query Band set to ['=S> org=teradata-internal-telem;appname=dbt;']
07:58:55 Catalog written to C:\dbt-teradata\jaffle_shop\jaffle_shop\target\catalog.json
Can you please share the sample model on which you are trying to build the catalog?
Thanks,
Mohan
Hi @tallamohan,
I believe the issue lies in the overridden get_catalog method in the TeradataAdapter, which has a different signature compared to the one in BaseAdapter:
- BaseAdapter:
get_catalog(relation_configs, used_schemas)
- TeradataAdapter:
get_catalog(manifest)
This discrepancy likely explains why it works for you but causes problems in our project. Our project's number of relations exceeds the MAX_SCHEMA_METADATA_RELATIONS
threshold (100), triggering the issue. It seems you are likely hitting the else section in the following code snippet:
https://github.com/dbt-labs/dbt-adapters/blob/d6f736956ef0948cb3fa61d2f5a00d4aa9a6a2aa/dbt/adapters/base/impl.py#L1185-L1195
if (
relations is None
or len(relations) > self.MAX_SCHEMA_METADATA_RELATIONS
or not self.supports(Capability.SchemaMetadataByRelations)
):
# Do it the traditional way. We get the full catalog.
catalogs, exceptions = self.get_catalog(relation_configs, used_schemas)
else:
# Do it the new way. We try to save time by selecting information
# only for the exact set of relations we are interested in.
catalogs, exceptions = self.get_catalog_by_relations(used_schemas, relations)
To ensure compatibility, the get_catalog method in TeradataAdapter should match the signature used in BaseAdapter.
Best regards,
Rafael