After deploying application to Google App Engine this warning is raised on (what it seems like) random requests.
/sqlalchemy/dialects/mysql/base.py:2452: SAWarning: No 'character_set_name' can be detected with this MySQL-Python version; please upgrade to a recent version of MySQL-Python. Assuming latin1.
The sql server is Google Cloud SQL.
Is there a way to fix it (maybe set character_set_name to some value) or it is totally dependent on the MySQL-Python version shipped with App Engine?
I got this issue if I used:
create_engine('mysql+gaerdbms:///xxx?instance=xxx:xxx')
but, it goes away if you use:
create_engine('mysql://root#127.0.0.1:3306/xxx?unix_socket=/cloudsql/xxx:xxx')
Related
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.
I have been trying to deploy my flask application in a raspbian os environment. The application was running smoothly on ubuntu and postgres 11. On trying to run sqlalchemy migration i encountered error: undefined symbol: PQencryptPasswordConn. I later found out that the missing library was added on postgres 10 and later versions hence missing in versions which were earlier before version 10. I cannot install version 10 or above on raspbian since it is yet to be supported. My only options are installing ubuntu core on my raspberry or find a Flask-SQLalchemy version that works with postgres 9.6. If anyone has been in my situation before or has a better idea your advice will be very much appreciated
I'm new to this stuff so I apologize if this is in the wrong place. I've inherited a Debian 7.14 system that has Django version 1.8.3 and Python version 2.7.6. It has a connection to SQL Server. We've just upgraded to SQL Server 2016 and are now getting the error
Exception Type: NotImplementedError
Exception Value: Sql Server v13 is not supported.
How can I upgrade to a newer version of Django for this connection to work again? What version will work with SQL Server 2016? I'm thinking it would be a good idea to upgrade Debian version as well while I'm at it, but I'm unsure whether that will break this further.
Any insight or suggestions is greatly appreciated, I've done a ton of research and I'm out of places to turn.
Most likely you're using an outdated version of Django MSSQL database connector. According to its change log, starting with v1.8 the connector support MS SQL Server 2012 and later.
In order to confirm this, check the DATABASES settings of your Django app, and see if it shows 'ENGINE': 'sqlserver_ado' as the connection type. If so,
pip install django-mssql --upgrade should fix your issue (though I haven't actually tested this).
EDIT: OK, so based on additional info from your comment ('ENGINE': 'sql_server.pyodbc' in the DATABASES settings), it looks like you're actually using django-pyodbc-azure as the database connector. This driver seems to be quite Django-version dependent. Let's first find out which version is in use:
pip show django-pyodbc-azure
The version you install should be the same as the Django version. If using Django 1.8, and if the django-pyodbc-azure version shows less than that, try installing the correct version:
pip install "django-pyodbc-azure<1.9"
I'm trying to transfer an Openshift-hosted Django website to Google App Engine. I wanted to connect it to an existing PostgreSQL database. However, I found this in Google's documentation:
A small percentage of native C python modules, and subsets of native C python modules are not available with Google App Engine. The disabled modules fall in to the following categories: (...)
Please keep in mind that third party packages which use any of the above features will not function with Google App Engine (packages such as PostgreSQL, etc).
My local GAE server produced the following error:
ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2._psycopg
Further research seems to indicate that this error was raised due to the limitations of GAE, rather than due to a configuration error. Surely there must be some reasonable way to connect my Django website with the externally hosted PostgreSQL server. What are my options?
Edit: so to clarify, I think I need a pure-Python replacement for psycopg2 that works with Django. In other words, it should also implement a Django database backend I can use.
You might be able to use pg8000.
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