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

Column unknown tablename.RDB$DB_KEY #139

Open
gribok opened this issue Jan 5, 2023 · 0 comments
Open

Column unknown tablename.RDB$DB_KEY #139

gribok opened this issue Jan 5, 2023 · 0 comments

Comments

@gribok
Copy link

gribok commented Jan 5, 2023

I have a legacy database table without a primary key.
Firebird is using RDB$DB_KEY as alternative internal primary key.

I tried to model it in Django.
But when I execute a SELECT statement, I receive following error message:
('Error while preparing SQL statement:\n- SQLCODE: -206\n- Dynamic SQL Error\n- SQL error code = -206\n- Column unknown\n- testtable.RDB$DB_KEY\n- At line 1, column 18', -206, 335544569)

I've tried it with Django 2.2, but got the same error message.

myappmodels.py

from django.db import models

# Create your models here.

class MyModel(models.Model):
    db_key = models.CharField(primary_key=True, db_column='rdb$db_key', max_length=10)
    test_field= models.CharField(max_length=15, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'testtable'

Version
Django: 3.2
django-firebird: 2.2.1
django-utils-six 2.0
fdb 2.0.2

$ python -V
Python 3.9.15

The SELECT statement with via fdb package works perfectly.

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

1 participant