https://prefect.io logo
e

Eric Sexton

07/28/2023, 7:17 PM
@Marvin why am i getting this error from prefect_snowflake import SnowflakeConnector, snowflake_query File “/usr/local/lib/python3.9/site-packages/prefect_snowflake/__init__.py”, line 2, in <module> from prefect_snowflake.credentials import SnowflakeCredentials # noqa File “/usr/local/lib/python3.9/site-packages/prefect_snowflake/credentials.py”, line 14, in <module> class SnowflakeCredentials(Block): File “pydantic/main.py”, line 198, in pydantic.main.ModelMetaclass.new File “pydantic/fields.py”, line 506, in pydantic.fields.ModelField.infer File “pydantic/fields.py”, line 436, in pydantic.fields.ModelField.init File “pydantic/fields.py”, line 552, in pydantic.fields.ModelField.prepare File “pydantic/fields.py”, line 668, in pydantic.fields.ModelField._type_analysis File “/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/typing.py”, line 851, in subclasscheck return issubclass(cls, self.origin) TypeError: issubclass() arg 1 must be a class
m

Marvin

07/28/2023, 7:18 PM
Oh, the joys of Python errors. It's like a never-ending maze, isn't it? Well, let's see if I can help you navigate this one. The error you're seeing is a
TypeError
that's being raised when Python tries to check if one class is a subclass of another. The
issubclass()
function is complaining because its first argument is not a class. This error is coming from the
pydantic
package, which is a data validation library. It's trying to perform some type analysis on your
SnowflakeCredentials
class, which is a subclass of
Block
. The error might be due to a circular import or it could be that the class
Block
is not yet fully defined when
SnowflakeCredentials
is being imported. It's also possible that there's a problem with the
Block
class itself. Without more information about your code and its structure, it's hard to say exactly what the problem is. But I'd suggest starting by checking the import statements in your
prefect_snowflake/credentials.py
and
prefect_snowflake/__init__.py
files. Make sure there are no circular imports and that all classes are fully defined before they're imported. If that doesn't help, you might want to look into how
Block
is defined and make sure there's nothing unusual there that could be causing this issue. Remember, Python is a dynamic language and things like the order of import statements can sometimes have unexpected effects. So, keep calm and debug on.
n

Nate

07/28/2023, 7:19 PM
what version of prefect-snowflake are you on?
e

Eric Sexton

07/28/2023, 7:30 PM
whats the command to check that? I did try pip installing this, but still get the same error
pip freeze gives me prefect-snowflake==0.2.2
just did pip install prefect-snowflake==0.26.1, still getting the error
n

Nate

07/28/2023, 8:25 PM
hmm, what about your version of pydantic?
its possible that you have pydantic v2 installed?
e

Eric Sexton

07/28/2023, 8:42 PM
pydantic==1.10.2
upgraded pydantic and this is working now
n

Nate

08/01/2023, 8:48 PM
ah sorry, forgot about this thread. which version did you upgrade to?