Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The error was: too many values to unpack (expected 11)" while running inspectdb #84

Closed
ClausSander opened this issue Feb 7, 2024 · 4 comments

Comments

@ClausSander
Copy link

ClausSander commented Feb 7, 2024

Hi,

I'm trying to perform the Django inspectdb command using my snowflake connection, but I get the following error:

> python manage.py inspectdb --database snowflake table_name
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
#   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from django.db import models
# Unable to inspect table 'table_name'
# The error was: too many values to unpack (expected 11)

I'm using:

  • python=3.11.6
  • django=4.2.7
  • django-snowflake=4.2

The database connection in settings.py is configured like this:

DATABASES = {
    ...
    'snowflake': {
        'ENGINE': env("SNOWFLAKE_ENGINE"),
        'NAME': env("SNOWFLAKE_NAME"),
        'SCHEMA': env("SNOWFLAKE_SCHEMA"),
        'WAREHOUSE': env("SNOWFLAKE_WAREHOUSE"),
        'USER': env("SNOWFLAKE_USER"),
        'PASSWORD': env("SNOWFLAKE_PASSWORD"),
        'ACCOUNT': env("SNOWFLAKE_ACCOUNT"),
        'OPTIONS': {
            'role': env("SNOWFLAKE_ROLE"),
        },
    }
}

I am able to access the data using the Django Shell, so I know the the connection is working.

>>> from django.db import connections
>>> conn = connections['snowflake']
>>> cursor = conn.cursor()
>>> cursor.execute("SELECT * FROM table_name").fetchall()
[(...), (...), ...]

Am I missing something here?
Thanks in advance.

@timgraham
Copy link
Collaborator

This will be fixed shortly, see #83.

@ClausSander
Copy link
Author

Great, thanks!

timgraham added a commit that referenced this issue Feb 7, 2024
…wflake's DESCRIBE TABLE change.

The "privacy domain" column is new in behavior change bundle 2023_08.

Fixes #84
@timgraham
Copy link
Collaborator

Please use django-snowflake 4.2.1, now available on PyPI.

@ClausSander
Copy link
Author

It works now, thanks for the quick fix!

timgraham added a commit that referenced this issue Feb 22, 2024
…wflake's DESCRIBE TABLE change.

The "privacy domain" column is new in behavior change bundle 2023_08.

Fixes #84
timgraham added a commit that referenced this issue Feb 22, 2024
…wflake's DESCRIBE TABLE change.

The "privacy domain" column is new in behavior change bundle 2023_08.

Fixes #84
timgraham added a commit that referenced this issue Feb 23, 2024
…wflake's DESCRIBE TABLE change.

The "privacy domain" column is new in behavior change bundle 2023_08.

Fixes #84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants