ibmdb / python-ibmdb-django

IBM DB2 Driver for the Django application Framework
Apache License 2.0
29 stars 42 forks source link

Informix Support #87

Closed andrewvillano closed 11 months ago

andrewvillano commented 1 year ago

I reached this page from the IBM Documentation that shows support for Informix v11+, https://www.ibm.com/docs/en/db2/9.7?topic=applications-python-sqlalchemy-django-framework

Latest version of the same document: https://www.ibm.com/docs/en/db2/11.5?topic=applications-python-sqlalchemy-django-framework

I have setup my Informix 14.x.x instance to use DRDA, which is the DB2 communication protocol.

The ibm-db python library supports informix, and I am able to extract data, however when I use ibm-db-django and run python manage.py inspectdb it returns an empty schema:

[andrew@villano-vm myproj]$ python manage.py inspectdb
# 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
[andrew@villano-vm myproj]$ 

Is there something I am missing?

Thanks.

praveen-db2 commented 1 year ago

@andrewvillano

  1. You need to add inspectdb under INSTALLED_APPS in setting.py file.
  2. you need to run below "django-admin.py makemigrations inspectdb --settings=settings" "django-admin.py migrate --setting=settings inspectdb" "./runtests.py --settings=settings inspectdb"
andrewvillano commented 1 year ago

I'm getting ModuleNotFoundError: No module named 'settings', whether or not I export DJANGO_SETTINGS_MODULE, prepend the appname to settings, run it in the parent or child directory, or use django-admin.py, django-admin or manage.py.

Same error.

praveen-db2 commented 1 year ago

@andrewvillano have you installed Django ? Can you provide me complete steps you followed from start right from installing python and its packages etc.... setting env vars. Have you created any django project ? I need complete process you followed so I can understand whats missing.

andrewvillano commented 1 year ago

I am running fedora 38,

[andrew@villano-vm reports]$ cat /etc/redhat-release
Fedora release 38 (Thirty Eight)

Using system python3

[andrew@villano-vm reports]$ python -V
Python 3.11.3

I installed ibm-db, tested it, then installed ibm-db-django.

[andrew@villano-vm reports]$ pip show ibm-db
Name: ibm-db
Version: 3.1.4

[andrew@villano-vm reports]$ pip show ibm-db-django
Name: ibm-db-django
Version: 1.5.2.0

I installed django3 from the system dnf repository (as I understand django v4 is not supported yet).

[andrew@villano-vm reports]$ rpm -q python3-django3
python3-django3-3.2.18-1.fc38.noarch

The only environment variables set are for Informix.

[andrew@villano-vm reports]$ env | grep -i DJANGO
PWD=/home/andrew/development/django/reports/reports
DJANGO_SETTINGS_MODULE=
OLDPWD=/home/andrew/development/django/reports

I then created a project with django-admin startproject myproj . To be sure, i also created another fresh project django-admin startproject reports . Neither project was able to run the command.

That's where I stand.

praveen-db2 commented 1 year ago

@andrewvillano were you able to resolve this ?

andrewvillano commented 1 year ago

No

praveen-db2 commented 1 year ago

@andrewvillano try running like "python manage.py migrate" "python manage.py test inspectdb"

If not worked, send me contents of your settings.py file.

praveen-db2 commented 11 months ago

Closing this as no response from user.