-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python manage.py migrate not working #57
Comments
Sorry, I can't reproduce this issue. My steps are:
Maybe I miss something? My dependencies are: ClickHouse server version 23.6.2.18 |
Are you using default database as Clickhouse? @jayvynl |
Also, does [django-clickhouse-backend] package support filter for array fields? |
Yes |
Yes, see docs/Fields.md |
Could you please share the django project code where you tested, for me and my colleague this is still not working? We are getting the same error
|
All codes are generated default by django 4.2.7 with Please try thease steps to check if you can get error: python3.8 -m venv venv
source venv/bin/activate
pip install django-clickhouse-backend
django-admin startproject aaa
# edit `aaa/aaa/settings.py` and add your clickhouse database settings.
cd aaa
python manage.py migrate |
Can confirm this issue. I'm unable to setup the database, even after dropping the "django_migrations" table, I always receive this error.
This is the settings.py
@vigneshshettyin Have you found a workaround by any chance? |
Nope. The option available is unmanaged tables. @ernestasga |
I was able to fix it by modifying table creation query. Feel free to use my fork until my PR is accepted and a new release is pushed. |
Thanks for suggesting the fix, I will create a monkey patch for the same until your PR is merged. |
Observed the same issue with constraints, It's not checking if the same constraint exists. Steps to achieve Create a model Event as below
1.python manage.py makemigrations - PASS If migrations is already applied and we try to migrate again, due to pre-existing same constraints it will FAIL. |
@jayvynl have you tried cloud hosted instane? I'm getting this error when connecting to cloud on port 9440, but if I spin up a self hosted server with docker, running on port 9000 the error disappears. |
I believe it may be server version incompatibility, since cloud is running v23.9 |
@ernestasga @vigneshshettyin I have write a test project for this issue, please test and verify. |
@jayvynl It is indeed version incompatibility. Cloud is running version 23.9. If you pull image |
Well done @ernestasga , the version does matter, I should have paid attention to the original version mentioned by @vigneshshettyin , however I didn't. I have checked ClickHouse 23.9 changelog. The type of field Thank you @ernestasga @vigneshshettyin. I will fix it soon. |
Waiting for the fix to be pushed @jayvynl ! |
Describe the bug
python manage.py migrate not working
To Reproduce
Create a new django app try connecting to Clickhouse then run migrate command
Expected behavior
It should create all default tables without any error
Logs
$ python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, polls, sessions
Running migrations:
Traceback (most recent call last):
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\clickhouse_driver\dbapi\cursor.py", line 111, in execute
response = execute(
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\clickhouse_backend\driver\client.py", line 53, in execute
rv = self.process_ordinary_query(
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\clickhouse_driver\client.py", line 571, in process_ordinary_query
return self.receive_result(with_column_types=with_column_types,
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\clickhouse_driver\client.py", line 204, in receive_result
return result.get_result()
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\clickhouse_driver\result.py", line 50, in get_result
for packet in self.packet_generator:
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\clickhouse_driver\client.py", line 220, in packet_generator
packet = self.receive_packet()
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\clickhouse_driver\client.py", line 237, in receive_packet
raise packet.exception
clickhouse_driver.errors.ServerException: Code: 57.
DB::Exception: Table django_local.django_migrations already exists. Stack trace:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\backends\utils.py", line 87, in _execute
return self.cursor.execute(sql)
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\clickhouse_backend\driver\connection.py", line 105, in execute
super().execute(operation, parameters)
File "C:\Users\vignesh\AppData\Local\Programs\Python\Python38\lib\site-packages\clickhouse_driver\dbapi\cursor.py", line 117, in execute
raise OperationalError(orig)
clickhouse_driver.dbapi.errors.OperationalError: Code: 57.
DB::Exception: Table django_local.django_migrations already exists. Stack trace:
Versions
SELECT version()
query. - 23.10.1.1976The text was updated successfully, but these errors were encountered: