I am trying to build a new adapter for one of the database so i created the custom macro in adapter.sql
{% macro mybaseadapter__list_schemas(database) -%}
SELECT SCHEMA_NAME FROM SYS.SCHEMAS;
{% endmacro %}
and then the function in impl to use this macro
def list_schemas(self, database: str):
schemas = self.execute_macro(“mybaseadapter__list_schemas”)
rel = [self.Relation.create(database=database, schema = schema) for schema in schemas]
return rel
but when i use the dbt run command i get this error
Encountered an error:
‘BaseRelation’ object has no attribute ‘lower’
09:21:26 Traceback (most recent call last):
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/cli/requires.py”, line 138, in wrapper
result, success = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/cli/requires.py”, line 101, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/cli/requires.py”, line 218, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/cli/requires.py”, line 247, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/cli/requires.py”, line 294, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/cli/requires.py”, line 332, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/cli/main.py”, line 569, in run
results = task.run()
^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/task/runnable.py”, line 526, in run
result = self.execute_with_hooks(selected_uids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/task/runnable.py”, line 486, in execute_with_hooks
self.before_run(adapter, selected_uids)
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/task/run.py”, line 459, in before_run
self.create_schemas(adapter, required_schemas)
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/task/runnable.py”, line 627, in create_schemas
existing_schemas_lowered.update(ls_future.result())
^^^^^^^^^^^^^^^^^^
File “/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py”, line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File “/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py”, line 401, in __get_result
raise self._exception
File “/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt_common/utils/executor.py”, line 16, in connected
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/task/runnable.py”, line 600, in list_schemas
return [
^
File “/Users/Downloads/Trial_Proj/dbt-env/lib/python3.11/site-packages/dbt/task/runnable.py”, line 601, in
(db_lowercase, s.lower())
^^^^^^^
AttributeError: ‘BaseRelation’ object has no attribute ‘lower’