Error with JSONField and mysql-connector
See original GitHub issuemodel code:
class MyModel(models.Model):
name = models.CharField(max_length=35)
data_json = JSONField()
makemigrations output
migrations.CreateModel(
name='MyModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=35)),
('data_json', JSONField(default=dict)),
])
Error on running migrate
django.db.utils.ProgrammingError: BLOB, TEXT, GEOMETRY or JSON column 'data_json' can't have a default value
- Django Version: Django 2.1.2
- Database and version used: MySQL 5.7
- MySQL driver: mysql-connector-python==8.0.13
- Version: Django-MySQL==2.4.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Issue with long JSON field and mysql source - Airbyte
I have a field in a source mysql database that is a very long JSON string. It's formatted as a JSON datatype. When...
Read more >Use of '.format()' vs. '%s' in cursor.execute() for mysql JSON ...
My objective is to store a JSON object into a MySQL database field of type json, using the mysql.connector library. import mysql.connector ......
Read more >Mysql JSON Type is failed with syntax error - Liquibase Forum
When I use liquibase diff 2 mysql 8.x database to generate changelog.xml with mysql connector 8.0.15 version. The JSON type is mapped to ......
Read more >81677: Allows to force JSON columns encoding into pure UTF-8
I tried to set the columns charset into pure utf8 but it seems we cannot do that. Could we have the choice of...
Read more >JSON array format in MySQL not working?
ERROR 3140 (22032): Invalid JSON text: "Missing a name for object member." at position 1 in value for column 'zz_TEST_ObsJSON.jsonData'. This ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Btw I have a plan to get Django to support
pymysql
, which I have done unofficially on a few projects and it’s worked fine (being a drop-in replacement formysqlclient
ex.MySQLdb
)Closing due to age.