Closed QuinnFreedman closed 2 years ago
Your first configuration looks okay. Do you have the same issue if Snowflake is the default database? Cedar is no longer contracting me to support this package but if you wish to hire me to debug your issue and/or write a fix if it turns out to be bug in this pacakge, feel free to reach out.
The cause was incorrect Snowflake permissions and/or database does not exist.
Having identical issue - and it's not permissions nor database issue:
File "/home/jm/django-test/django_env/lib/python3.10/site-packages/django/db/migrations/recorder.py", line 72, in ensure_schema raise MigrationSchemaMissing( django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (Cannot perform CREATE TABLE. This session does not have a current database. Call 'USE DATABASE', or use a qualified name.)
When I debugged this for the original reporter, it might be that ALTER USER django_user SET DEFAULT_ROLE="SYSADMIN"
was helpful. How did you confirm your permissions are correct? Are you able to execute queries with snowflake-connector-python?
Yes, I can run queries with snowflake connector, no issues. The problem I noticed is exactly what error says. When I open DB shell this is what I get:
python manage.py dbshell
although when I just hit ENTER key this is what I get:
Apparently open session has no clue about warehouse, database and schema listed in the first prompt.
Try running SHOW DATABASES;
at the dbshell prompt. If you can't see your target database, you know you have a permissions issue. If that's the case, you may find this StackOverflow answer helpful.
You are absolutely correct, when I used different user it all works well.
When I try to run
migrate
for the Snowflake database, I get the following error:It seems like a database is not being selected before trying to create a table. My
DATABASES
config looks like this:I tried adding
database
toOPTIONS
like this:but it didn't help.
Have I configured something wrong? Or is this an issue with
django-snowflake
? Does django-snowflake support migrations and creating tables?