You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And after applying this migration I can't run python manage.py pgpartition
I have this error
Traceback (most recent call last):
File "/Users/orphey/Coding/skm/manage.py", line 22, in <module>
main()
File "/Users/orphey/Coding/skm/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/orphey/Coding/skm/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/Users/orphey/Coding/skm/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/orphey/Coding/skm/venv/lib/python3.11/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/orphey/Coding/skm/venv/lib/python3.11/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/orphey/Coding/skm/venv/lib/python3.11/site-packages/psqlextra/management/commands/pgpartition.py", line 72, in handle
plan = partitioning_manager.plan(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/orphey/Coding/skm/venv/lib/python3.11/site-packages/psqlextra/partitioning/manager.py", line 52, in plan
model_plan = self._plan_for_config(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/orphey/Coding/skm/venv/lib/python3.11/site-packages/psqlextra/partitioning/manager.py", line 84, in _plan_for_config
table = self._get_partitioned_table(connection, config.model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/orphey/Coding/skm/venv/lib/python3.11/site-packages/psqlextra/partitioning/manager.py", line 121, in _get_partitioned_table
raise PostgresPartitioningError(
psqlextra.partitioning.error.PostgresPartitioningError: Model StatRecord, with table core_statrecord does not exists in the database. Did you run `python manage.py migrate`?
The text was updated successfully, but these errors were encountered:
write another migration to rename table into the old name
And if you have foreign keys pointing to the table you want to partition, there'll be complications when dropping the old table - the partitioned table will probably have different primary keys now (because they will include the partition keys) -- so you will have to rebuild all the FKs by doing the above create/copy/drop/rename for those too
Can't add partitioning to existing models.
In my app I have the model, which I want to optimize by partitioning.
My old model:
Partitioned model:
I have a partitioning manager in
app/partitioning.py
. AndPSQLEXTRA_PARTITIONING_MANAGER
param in settings.But
python manage.py pgmakemigrations
make strange migrations, which do not allow working with partitions.Generated migration:
And after applying this migration I can't run
python manage.py pgpartition
I have this error
The text was updated successfully, but these errors were encountered: