[CT-3020] More defensive code around fetchmany
in SQLConnectionManager.get_result_from_cursor
#8471
Closed
1 task done
Labels
adapter_plugins
Issues relating to third-party adapter plugins
Housekeeping
Short description
In #7545, we changed
dbt show --limit
to apply the limit while fetching the result set from the database cursor, instead of after the full result set was already fetched and loaded into memory.dbt-core/core/dbt/adapters/sql/connections.py
Lines 126 to 127 in 582faa1
However, multiple adapter maintainers weren't aware that they needed to add a
fetchmany
method, leading to issues in some externally maintained adapters upon upgrading to v1.6:'DatabricksSQLCursorWrapper' object has no attribute 'fetchmany'
databricks/dbt-databricks#408Instead of raising an ugly error (
'DatabricksSQLCursorWrapper' object has no attribute 'fetchmany'
), we should:fetchmany
methodAcceptance criteria
dbt show --limit 10
on an adapter that inherits from the "SQL adapter," and does not support afetchmany
method. The final result set should still be limited to10
. (I imagine we'd want a unit test to mock this scenario.)dbt-tests-adapter
fordbt show --limit
. Adapter maintainers know to inherit & use this test case when validating their upgrade to v1.6. We have reflected the need for afetchmany
method in the v1.6 adapter maintainer guide: Adapter Maintainers: Upgrading to dbt-core `1.6.0` #7958.Impact to Other Teams
Adapters
Will backports be required?
1.6.latest
Context
No response
The text was updated successfully, but these errors were encountered: