Open optroodt opened 5 years ago
I'm running into this as well. Did you figure out a solution?
No, I didn't. I set the project aside for a bit. What's your environment (os, python etc)?
OS: macOS Mojave 10.14.2 Python: 3.7.0
I found this thread googling the same error. I believe my issue was related to some missing under scores.
I had defined a class
class table(base): tablename = 'table' table_args = {'schema': 'schema', 'autoload': True, 'autoload_with': engine} and when the class is defined it couldn't find the table_args
adding the underscores to __tableargs -> \_tableargs_\ fixed my issue.
@optroodt @sryza Can you reproduce @lsatterfield's fix?
I seem to have made a mistake in my earlier post. I didnt realize it would bold if i had leading and trailing underscores. Should be __tableargs -> \_tableargs_\ .
-- Edited Above for accuracy, thanks timofurrer
You can put the code in backticks. See https://help.github.com/en/articles/creating-and-highlighting-code-blocks
(you can edit your post above) 🎉
If I understand correctly, I don't think @lsatterfield's fix applies in my case. All I'm doing is
sqlalchemy_cols = [Column(col_name, data_type, comment=comment) for col_name, data_type, comment in columns]
metadata = MetaData(bind=con)
table = Table(table_name, metadata, *sqlalchemy_cols, schema=schema)
table.create()
where con is a connection from a snowflake SQLAlchemy engine.
I also don't think @lsatterfield 's fix is related. I'm not configuring anything in SQLAlchemy, just running a plain query.
I can say that it works without problems under Python 3.6.5.
@optroodt You need to close the connection and dispose the engine. Try add the following at the end:
connection.close()
engine.dispose()
I'm experiencing the same issue, running into this when I do python xxx.py
. Note that I log in with two factor auth and have to log in twice (once for the connection, once for create table). Confusingly, it works when i define a function and then call that function, or when I run the code in an interactive shell. (Python 3.7.4)
@peterolive thanks! This solved my issue with this error
Probable root cause in the Snowflake's Python connector: https://community.snowflake.com/s/article/Python-connector-does-not-implement-a-destructor-method-correctly
I'm trying to use records with Snowflake (dwh solution in the cloud), and I do get results but I always get the ModuleNotFoundError error.
It works without any problems when I use just SqlAlchemy using snowflake-sqlalchemy, so that makes me think it's something records specific. I really like the product and, although my resources are limited, I'm willing to assist or provide more information if requested.
I'm running Python 3.7.2, installed through homebrew, in a virtualenv on MacOS 10.14.3.
Installed packages:
Code to reproduce (credentials and account are obviously not the ones I use):
Stacktrace
Thanks!