PrefectHQ / prefect

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.
https://prefect.io
Apache License 2.0
15.96k stars 1.57k forks source link

Failed to load collection prefect_dbt when loading prefect_snowflake #12960

Open johnkangw opened 1 year ago

johnkangw commented 1 year ago

Expectation / Proposal:

No import errors

Traceback / Example:

When importing SnowflakeConnector: from prefect_snowflake.database import SnowflakeConnector I receive this below warning: Warning! Failed to load collection 'prefect_dbt': ImportError: cannot import name 'SnowflakeCredentials' from partially initialized module 'prefect_snowflake' (most likely due to a circular import) (C:\Users\JKANG1\.conda\envs\Capacity_venv\lib\site-packages\prefect_snowflake\__init__.py)

Versions: Name: prefect-dbt Version: 0.3.1 Summary: Prefect integration for working with dbt Home-page: https://github.com/PrefectHQ/prefect-dbt Author: Prefect Technologies, Inc. Author-email: help@prefect.io License: Apache License 2.0 Location: c:\users\jkang1.conda\envs\capacity_venv\lib\site-packages Requires: dbt-core, prefect, prefect-shell, sgqlc Required-by:

Name: prefect-snowflake Version: 0.26.1 Summary: Prefect integrations for interacting with Snowflake. Home-page: https://github.com/PrefectHQ/prefect-snowflake Author: Prefect Technologies, Inc. Author-email: help@prefect.io License: Apache License 2.0 Location: c:\users\jkang1.conda\envs\capacity_venv\lib\site-packages Requires: prefect, snowflake-connector-python Required-by:

Version: 2.8.5 API version: 0.8.4 Python version: 3.9.16 Git commit: 81a67202 Built: Thu, Mar 9, 2023 4:27 PM OS/Arch: win32/AMD64 Profile: default Server type: cloud

seanpwlms commented 1 year ago

@johnkangw were you by chance running the code from a file named prefect_dbt.py?

johnkangw commented 1 year ago

@seanpwlms I checked on pycharm, and the only instances of prefect_dbt look like they are from the imports. Is that misused?

https://github.com/PrefectHQ/prefect/issues/12960

seanpwlms commented 1 year ago

Sorry, to clarify, if you store your flow code in a file called prefect_dbt.py and run something like python prefect_dbt.py I believe you can run into a circular import

johnkangw commented 1 year ago

@seanpwlms Thanks for the heads up. I am not storing flow code in prefect_dbt.py. I'm just importing that module, so I should not have a circular import issue due to that.

image