Can any one help me with this question

40 views
Skip to first unread message

Annadatha Rao

unread,
Jun 18, 2023, 11:30:32 AM6/18/23
to django...@googlegroups.com
Dear All,

Do DJANGO migrations work with Oracle 11.2 with python-oracle db driver, please show me an example if works.

Thank you for your support,
Annadatha.

Praveen Chaudhary

unread,
Jun 18, 2023, 11:49:34 AM6/18/23
to django...@googlegroups.com

Yes, Django migrations can work with Oracle 11.2 using the python-oracle database driver. However, it's important to note that the python-oracle package is not an official Oracle-provided driver. The official driver is called cx_Oracle, which is widely used for connecting Django to Oracle databases.

Here's an example of how Django migrations can work with Oracle 11.2 using cx_Oracle:

1. Install the cx_Oracle package using pip:
     pip install cx_Oracle
2.Update your Django project's settings.py file to include the Oracle database configuration:
     DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.oracle',
        'NAME': 'your_database_name',
        'USER': 'your_username',
        'PASSWORD': 'your_password',
        'HOST': 'your_host',
        'PORT': 'your_port',
    }
}

Replace the 'your_database_name', 'your_username', 'your_password', 'your_host', and 'your_port' with the appropriate values for your Oracle database.

3.Define your Django models in the models.py file.
4.Generate and apply the migrations using Django's makemigrations and migrate commands:

These commands will generate the necessary SQL statements based on your models and apply them to the Oracle database.

Please note that the example assumes you have already set up Oracle 11.2 and have the necessary Oracle client software installed on your machine.

It's also important to ensure that your version of Django is compatible with Oracle 11.2. Refer to the Django documentation and the documentation of the cx_Oracle package for any specific requirements or considerations when working with Oracle databases.

Remember to replace 'your_database_name', 'your_username', 'your_password', 'your_host', and 'your_port' with the appropriate values for your Oracle database configuration.

Prabin Chaudhary
Software Engineer | Youth Innovation Lab


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFtPNJw9wQgAo2jCFEs6undCf9FZ_oqww9kZWKLLaJAMGyoNaA%40mail.gmail.com.

Annadatha Rao

unread,
Jun 18, 2023, 12:05:46 PM6/18/23
to django...@googlegroups.com
Thank you very much praveen, I will try and let you know. 

Annadatja




Annadatha Rao

unread,
Jun 22, 2023, 10:10:38 AM6/22/23
to django...@googlegroups.com
Hi  Prabin,

Thank you, it worked when I upgraded db to 21c (oracle), thank you for your help. Small question, can I work without migrations, some have I hate migrations being a legacy programmer from (Cobol days). I value your opinion.

Thank you,
ANNADATHA.

Praveen Chaudhary

unread,
Jun 22, 2023, 1:15:58 PM6/22/23
to django...@googlegroups.com
Hi Annadatha,

I'm glad to hear that upgrading to Oracle 21c worked for you. As for your question about working without migrations in Django, it's certainly possible but it's important to understand the implication and trade-offs.

Django migrations provide a way to manage and apply changes to your database schema over time, allowing for version control and easy deployment of database changes. They help maintain data integrity and make it easier to collaborate with other developers.

However, if you prefer not to use migrations, you can disable them in django by setting the 'MIGRATIIN_MODULES' setting to an empty dictionary in your projects settings.py file:

 MIGRATION_MODULES = {}


By doing this, you'll essentially disable the migration framework, and Django won't generate or apply migrations. Instead, you'll need to manually manage your database schema changes, which can be more error-prone and less convenient, especially in collaborative projects.

Keep in mind the following considerations if you decide to work without migrations:

1. Database schema management: You'll need to manually create, modify, and delete database tables, columns, and other schema elements as needed. This requires careful coordination and communication between developers working on the project.

2. Data integrity: Migrations help ensure data integrity during schema changes by providing a way to define and execute data transformations. Without migrations, you'll need to handle data migrations and transformations manually, which can be challenging and error-prone.

3. Deployment and version control: Migrations provide a structured way to apply schema changes to your database during deployment. Without migrations, you'll need to find alternative approaches for managing database changes in different environments and version controlling those changes.

Ultimately, the decision to use or not use migrations depends on your specific requirements, project complexity, and team collaboration. If you're working on a small, personal project with a simple schema and limited changes, managing the database schema manually might be feasible. However, for larger projects or teams, migrations can provide significant benefits in terms of maintainability, collaboration, and data integrity.

I hope this helps you make an informed decision. Let me know if you have any further questions!

Best regards
Prabin Chaudhary
Software Engineer | Youth Innovation Lab

Annadatha Rao

unread,
Jun 22, 2023, 1:53:58 PM6/22/23
to django...@googlegroups.com
Thank you for your reply. 

Annadatha. 

Annadatha Rao

unread,
Jun 22, 2023, 6:17:56 PM6/22/23
to django...@googlegroups.com
Hi, 

Can you please recommend any ui components to use with django, like graphs, datagrid etc. 

With regards, 

Annadatha. 
Reply all
Reply to author
Forward
0 new messages