I am getting this strange error
ProgrammingError at /save_hsn/
syntax error at or near "ON"
LINE 1: ...021-01-28T06:17:43.784614+00:00'::timestamptz, 1) ON CONFLIC...
this is my views.py part where I am getting the error
user_gst_codes.objects.bulk_create(hsn_list, ignore_conflicts=True)
If I remove ignore_conflicts=True, everything works.
Moreover, I start getting this error after deploying my Django app on cPanel, on localhost this doesn't give any error.
On localhost-
Python 3.6.6, Django 3.1
On cPanel-
Python 3.6.11, Django 3.1
Is this an issue with the Python version?
I am inserting data in bulk and also need to keep the unique check.
Any help would be appreciated.
Notice that the ON CONFLICT clause is only available from PostgreSQL 9.5. If you are using an earlier version, you will need a workaround to have the upsert feature. Please check local postgresql version and server postgresql version.
Related
I have an existing database in Oracle 11.2.
I am trying to use inspectdb utility of django to automatically create the models but I am getting the error:
ORA-00904: "IDENTITY_COLUMN": invalid identifier
There is no column named IDENTITY_COLUMN in any of the tables and since I am not directly accessing the database, the chances of misspelling a column name or accessing a wrong column is not possible.
It would be very helpful if someone can give a direction as to what to fix to solve this error.
I had a similar problem also working with Oracle 11.2
I downgraded Django===2.1 to Django===1.11.13 temporarily to run inspectdb as a work around since my legacy models needed to be manually cleaned up anyway, but it was a good place to start for reverse engineering models from a legacy db.
Same thing happened to me . First downgrade your django into a lower version (1.11.22) and run
python manage.py inspectdb > your_app_name/models.py
Then upgrade to whatever version you are using . I was using 3.0.4
I'm not sure if it is possible.
The docs don't mention Oracle:
inspectdb works with PostgreSQL, MySQL and SQLite.
But a user said they got it working, for example this comment in a previous question. See also this older question for some hints.
I have downloaded Mayan EDMS-Electronic Document Management System from GitHub and I configured project using Django server. I had added the required libraries based on requirement. when I tried to migrate Django using Mysql server, I got the error:
django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'value' used in key specification without a key length")
When I searched this error, I found -->MySQL error: key specification without a key length. but I occur error while migration.
django version - 1.11.5,
mysql version - 5.7.20
please help me to find the problem. thanks in advance
I had a Django project that I had worked on in the past for quite a while. Recently, I tried to reopen it and add some minor changes. What happened is that recently I also reinstalled MySQL(8.0) and of course, recreated my old database. But now when I tried to run the server or any other operation, I get the following error:
2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.
I tried the solution from other post, but it did not work for me. Here is also a full traceback of the error: https://pastebin.com/JqexqTtC
I had the same problem and I fix this issue with the first method:
If you have access to database through workbench, mysql console... and you have permission to alter user so you can change auth_plugin for default
ALTER USER 'your_user' IDENTIFIED WITH mysql_native_password BY 'your_password';
If you don't have permission to it database so you can change mysql connector.
add link: https://www.codegrepper.com/code-examples/sql/raise+errors.NotSupportedError%28+mysql.connector.errors.NotSupportedError%3A+Authentication+plugin+%27caching_sha2_password%27+is+not+supported
I need help switching my database engine from sqlite to mysql. manage.py datadump is returning the same error that pops up when I try to do anything else with manage.py : ImproperlyConfigured: Error loading MySQL module, No module named MySQLdb.
This django project is a team project. I pulled new changes from bitbucket and our backend has a new configuration. This new configuration needs mysql (and not sqlite) to work. Our lead dev is sleeping right now. I need help so I can get started working again.
Edit: How will I get the data in the sqlite database file into the new MySQL Database?
According to the Database setup paragraph in Django docs:
By default, the configuration uses SQLite.
If you wish to use another database, install the appropriate database
bindings...
And Get your database running page says:
If you’re using MySQL, you’ll need the MySQL-python package, version
1.2.1p2 or higher.
To use MySQL backend you need a tool that would help Django talk to the database, an adapter.
In other words, MySQL-python (aka MySQLdb) package needs to be installed.
Try the followings steps:
1. Change DATABASES in settings.py to MYSQL engine
2. Run $ ./manage.py syncdb
I'm not sure if this is an issue specific to sqlite databases but after adding some properties I executed syncdb successfully but still the the columns were not added to the database and when I try the access the model in admin I get no such column error.
Why is this happening and how do I overcome this issue?
Details: Django 1.3, Python 2.6, OSX 10.6, PyCharm.
sync db doesn't make integrate schema changes once the tables are created. You have to delete the database manually and do syncdb again. See the boxed information in this link
http://docs.djangoproject.com/en/dev/ref/django-admin/#syncdb
As always, syncdb does not migrate the existing schema.
I think one can find solution here: A nice blog to start with Django:
Getting Started with Django REST Framework (DRF) and AngularJS :
http://engineroom.trackmaven.com/blog/getting-started-drf-angularjs-part-1/