piccolo 1.8.0__tar.gz → 1.10.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {piccolo-1.8.0 → piccolo-1.10.0}/PKG-INFO +1 -1
- piccolo-1.10.0/piccolo/__init__.py +1 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/fixtures/commands/load.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/auto/__init__.py +8 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/auto/migration_manager.py +2 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/commands/backwards.py +3 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/commands/base.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/commands/check.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/commands/clean.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/commands/forwards.py +3 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/commands/new.py +4 -2
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/schema/commands/generate.py +2 -2
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/shell/commands/run.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/base.py +55 -29
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/column_types.py +28 -4
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/defaults/base.py +6 -4
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/defaults/date.py +9 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/defaults/interval.py +1 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/defaults/time.py +9 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/defaults/timestamp.py +1 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/defaults/uuid.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/m2m.py +7 -7
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/operators/comparison.py +4 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/conf/apps.py +9 -4
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/engine/base.py +69 -20
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/engine/cockroach.py +2 -3
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/engine/postgres.py +33 -19
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/engine/sqlite.py +27 -22
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/functions/__init__.py +5 -0
- piccolo-1.10.0/piccolo/query/functions/math.py +48 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/create_index.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/drop_index.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/objects.py +7 -7
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/select.py +13 -7
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/mixins.py +3 -10
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/querystring.py +18 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/schema.py +20 -12
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/table.py +22 -21
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/encoding.py +5 -3
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo.egg-info/PKG-INFO +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo.egg-info/SOURCES.txt +8 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/pyproject.toml +2 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/auto/integration/test_migrations.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_array.py +91 -19
- piccolo-1.10.0/tests/columns/test_get_sql_value.py +66 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/conf/test_apps.py +1 -1
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/engine/test_nested_transaction.py +2 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/engine/test_transaction.py +1 -2
- piccolo-1.10.0/tests/query/functions/base.py +34 -0
- piccolo-1.10.0/tests/query/functions/test_functions.py +64 -0
- piccolo-1.10.0/tests/query/functions/test_math.py +39 -0
- piccolo-1.10.0/tests/query/functions/test_string.py +25 -0
- piccolo-1.10.0/tests/query/functions/test_type_conversion.py +134 -0
- piccolo-1.10.0/tests/query/test_querystring.py +166 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_indexes.py +4 -2
- piccolo-1.10.0/tests/utils/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_pydantic.py +70 -29
- piccolo-1.8.0/piccolo/__init__.py +0 -1
- piccolo-1.8.0/tests/query/test_functions.py +0 -238
- piccolo-1.8.0/tests/query/test_querystring.py +0 -30
- {piccolo-1.8.0 → piccolo-1.10.0}/LICENSE +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/README.md +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/app/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/app/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/app/commands/new.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/app/commands/show_all.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/app/commands/templates/piccolo_app.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/app/commands/templates/tables.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/app/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/new.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/README.md.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/_blacksheep_app.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/_lilya_app.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/_litestar_app.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/_starlette_app.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/app.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/conftest.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/__init__.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/_blacksheep_endpoints.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/_esmerald_endpoints.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/_lilya_endpoints.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/_litestar_endpoints.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/_starlette_endpoints.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/endpoints.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_app.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_migrations/README.md +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/tables.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/templates/base.html.jinja_raw +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/home/templates/home.html.jinja_raw +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/main.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf_test.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/static/favicon.ico +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/commands/templates/app/static/main.css +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/asgi/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/fixtures/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/fixtures/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/fixtures/commands/dump.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/fixtures/commands/shared.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/fixtures/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/meta/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/meta/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/meta/commands/version.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/meta/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/auto/diffable_table.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/auto/operations.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/auto/schema_differ.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/auto/schema_snapshot.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/auto/serialisation.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/auto/serialisation_legacy.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/commands/templates/migration.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/migrations/tables.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/playground/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/playground/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/playground/commands/run.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/playground/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/project/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/project/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/project/commands/new.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/project/commands/templates/piccolo_conf.py.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/project/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/schema/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/schema/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/schema/commands/exceptions.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/schema/commands/graph.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/schema/commands/templates/graphviz.dot.jinja +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/schema/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/shell/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/shell/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/shell/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/sql_shell/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/sql_shell/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/sql_shell/commands/run.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/sql_shell/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/tester/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/tester/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/tester/commands/run.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/tester/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/commands/change_password.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/commands/change_permissions.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/commands/create.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/commands/list.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/piccolo_migrations/2019-11-14T21-52-21.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/piccolo_migrations/2020-06-11T21-38-55.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/piccolo_migrations/2021-04-30T16-14-15.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/piccolo_migrations/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/apps/user/tables.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/choices.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/combination.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/defaults/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/defaults/timestamptz.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/indexes.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/operators/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/operators/base.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/operators/math.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/operators/string.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/readable.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/columns/reference.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/conf/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/custom_types.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/engine/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/engine/exceptions.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/engine/finder.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/main.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/py.typed +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/base.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/functions/aggregate.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/functions/base.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/functions/string.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/functions/type_conversion.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/alter.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/count.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/create.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/delete.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/exists.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/indexes.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/insert.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/raw.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/refresh.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/table_exists.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/methods/update.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/query/proxy.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/table_reflection.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/testing/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/testing/model_builder.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/testing/random_builder.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/dictionary.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/graphlib/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/graphlib/_graphlib.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/lazy_loader.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/list.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/naming.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/objects.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/printing.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/pydantic.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/repr.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/sql_values.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/sync.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo/utils/warnings.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo.egg-info/dependency_links.txt +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo.egg-info/entry_points.txt +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo.egg-info/requires.txt +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/piccolo.egg-info/top_level.txt +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/profiling/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/profiling/run_profile.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/setup.cfg +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/setup.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/app/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/app/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/app/commands/test_new.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/app/commands/test_show_all.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/asgi/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/asgi/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/asgi/commands/test_new.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/fixtures/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/fixtures/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/fixtures/commands/test_dump_load.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/fixtures/commands/test_shared.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/meta/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/meta/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/meta/commands/test_version.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/auto/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/auto/integration/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/auto/test_diffable_table.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/auto/test_migration_manager.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/auto/test_schema_differ.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/auto/test_schema_snapshot.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/auto/test_serialisation.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/commands/test_base.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/commands/test_check.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/commands/test_clean.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/commands/test_forwards_backwards.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/commands/test_migrations/2020-03-31T20-38-22.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/commands/test_migrations/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/commands/test_new.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/migrations/test_migration.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/project/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/project/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/project/commands/test_new.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/schema/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/shell/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/shell/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/shell/commands/test_run.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/sql_shell/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/sql_shell/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/sql_shell/commands/test_run.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/tester/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/user/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/user/commands/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/user/commands/test_change_password.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/user/commands/test_change_permissions.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/user/commands/test_create.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/user/commands/test_list.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/apps/user/test_tables.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/m2m/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/m2m/base.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/m2m/test_m2m.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/m2m/test_m2m_schema.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_base.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_bigint.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_boolean.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_bytea.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_choices.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_combination.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_date.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_db_column_name.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_defaults.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_double_precision.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_interval.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_json.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_jsonb.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_numeric.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_primary_key.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_readable.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_real.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_reference.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_reserved_column_names.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_smallint.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_time.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_timestamp.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_timestamptz.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_uuid.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/columns/test_varchar.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/conf/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/conf/example.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/engine/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/engine/test_extra_nodes.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/engine/test_logging.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/engine/test_pool.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/engine/test_version_parsing.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/mega/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/mega/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/mega/piccolo_migrations/2021-09-20T21-23-25-698988.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/mega/piccolo_migrations/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/mega/tables.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/music/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/music/piccolo_app.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/music/tables.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/example_apps/music/tables_detailed.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/query/__init__.py +0 -0
- {piccolo-1.8.0/tests/query/mixins → piccolo-1.10.0/tests/query/functions}/__init__.py +0 -0
- {piccolo-1.8.0/tests/table → piccolo-1.10.0/tests/query/mixins}/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/query/mixins/test_columns_delegate.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/query/mixins/test_order_by_delegate.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/query/test_await.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/query/test_camelcase.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/query/test_freeze.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/query/test_gather.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/query/test_slots.py +0 -0
- {piccolo-1.8.0/tests/table/instance → piccolo-1.10.0/tests/table}/__init__.py +0 -0
- {piccolo-1.8.0/tests/testing → piccolo-1.10.0/tests/table/instance}/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/instance/test_create.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/instance/test_get_related.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/instance/test_get_related_readable.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/instance/test_instantiate.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/instance/test_remove.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/instance/test_save.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/instance/test_to_dict.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_all_columns.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_alter.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_batch.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_callback.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_constructor.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_count.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_create.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_create_db_tables.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_create_table_class.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_delete.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_drop_db_tables.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_exists.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_from_dict.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_inheritance.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_insert.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_join.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_join_on.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_metaclass.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_objects.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_output.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_raw.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_ref.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_refresh.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_repr.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_select.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_str.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_table_exists.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/table/test_update.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/test_main.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/test_schema.py +0 -0
- {piccolo-1.8.0/tests/utils → piccolo-1.10.0/tests/testing}/__init__.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/testing/test_model_builder.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/testing/test_random_builder.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_dictionary.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_encoding.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_lazy_loader.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_list.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_naming.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_printing.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_sql_values.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_sync.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_table_reflection.py +0 -0
- {piccolo-1.8.0 → piccolo-1.10.0}/tests/utils/test_warnings.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__VERSION__ = "1.10.0"
|
@@ -2,3 +2,11 @@ from .diffable_table import DiffableTable
|
|
2
2
|
from .migration_manager import MigrationManager
|
3
3
|
from .schema_differ import AlterStatements, SchemaDiffer
|
4
4
|
from .schema_snapshot import SchemaSnapshot
|
5
|
+
|
6
|
+
__all__ = [
|
7
|
+
"DiffableTable",
|
8
|
+
"MigrationManager",
|
9
|
+
"AlterStatements",
|
10
|
+
"SchemaDiffer",
|
11
|
+
"SchemaSnapshot",
|
12
|
+
]
|
@@ -261,7 +261,8 @@ class MigrationManager:
|
|
261
261
|
cleaned_params = deserialise_params(params=params)
|
262
262
|
column = column_class(**cleaned_params)
|
263
263
|
column._meta.name = column_name
|
264
|
-
|
264
|
+
if db_column_name:
|
265
|
+
column._meta.db_column_name = db_column_name
|
265
266
|
|
266
267
|
self.add_columns.append(
|
267
268
|
AddColumnClass(
|
@@ -32,7 +32,9 @@ class BackwardsMigrationManager(BaseMigrationManager):
|
|
32
32
|
|
33
33
|
async def run_migrations_backwards(self, app_config: AppConfig):
|
34
34
|
migration_modules: t.Dict[str, MigrationModule] = (
|
35
|
-
self.get_migration_modules(
|
35
|
+
self.get_migration_modules(
|
36
|
+
app_config.resolved_migrations_folder_path
|
37
|
+
)
|
36
38
|
)
|
37
39
|
|
38
40
|
ran_migration_ids = await Migration.get_migrations_which_ran(
|
@@ -86,7 +86,7 @@ class BaseMigrationManager(Finder):
|
|
86
86
|
"""
|
87
87
|
migration_managers: t.List[MigrationManager] = []
|
88
88
|
|
89
|
-
migrations_folder = app_config.
|
89
|
+
migrations_folder = app_config.resolved_migrations_folder_path
|
90
90
|
|
91
91
|
migration_modules: t.Dict[str, MigrationModule] = (
|
92
92
|
self.get_migration_modules(migrations_folder)
|
@@ -36,7 +36,7 @@ class CheckMigrationManager(BaseMigrationManager):
|
|
36
36
|
continue
|
37
37
|
|
38
38
|
migration_modules = self.get_migration_modules(
|
39
|
-
app_config.
|
39
|
+
app_config.resolved_migrations_folder_path
|
40
40
|
)
|
41
41
|
ids = self.get_migration_ids(migration_modules)
|
42
42
|
for _id in ids:
|
@@ -20,7 +20,7 @@ class CleanMigrationManager(BaseMigrationManager):
|
|
20
20
|
app_config = self.get_app_config(app_name=self.app_name)
|
21
21
|
|
22
22
|
migration_module_dict = self.get_migration_modules(
|
23
|
-
folder_path=app_config.
|
23
|
+
folder_path=app_config.resolved_migrations_folder_path
|
24
24
|
)
|
25
25
|
|
26
26
|
# The migration IDs which are in migration modules.
|
@@ -33,7 +33,9 @@ class ForwardsMigrationManager(BaseMigrationManager):
|
|
33
33
|
)
|
34
34
|
|
35
35
|
migration_modules: t.Dict[str, MigrationModule] = (
|
36
|
-
self.get_migration_modules(
|
36
|
+
self.get_migration_modules(
|
37
|
+
app_config.resolved_migrations_folder_path
|
38
|
+
)
|
37
39
|
)
|
38
40
|
|
39
41
|
ids = self.get_migration_ids(migration_modules)
|
@@ -98,7 +98,9 @@ def _generate_migration_meta(app_config: AppConfig) -> NewMigrationMeta:
|
|
98
98
|
|
99
99
|
filename = f"{cleaned_app_name}_{cleaned_id}"
|
100
100
|
|
101
|
-
path = os.path.join(
|
101
|
+
path = os.path.join(
|
102
|
+
app_config.resolved_migrations_folder_path, f"{filename}.py"
|
103
|
+
)
|
102
104
|
|
103
105
|
return NewMigrationMeta(
|
104
106
|
migration_id=_id, migration_filename=filename, migration_path=path
|
@@ -255,7 +257,7 @@ async def new(
|
|
255
257
|
|
256
258
|
app_config = Finder().get_app_config(app_name=app_name)
|
257
259
|
|
258
|
-
_create_migrations_folder(app_config.
|
260
|
+
_create_migrations_folder(app_config.resolved_migrations_folder_path)
|
259
261
|
|
260
262
|
try:
|
261
263
|
await _create_new_migration(
|
@@ -313,7 +313,7 @@ COLUMN_TYPE_MAP_COCKROACH: t.Dict[str, t.Type[Column]] = {
|
|
313
313
|
**{"integer": BigInt, "json": JSONB},
|
314
314
|
}
|
315
315
|
|
316
|
-
COLUMN_DEFAULT_PARSER = {
|
316
|
+
COLUMN_DEFAULT_PARSER: t.Dict[t.Type[Column], t.Any] = {
|
317
317
|
BigInt: re.compile(r"^'?(?P<value>-?[0-9]\d*)'?(?:::bigint)?$"),
|
318
318
|
Boolean: re.compile(r"^(?P<value>true|false)$"),
|
319
319
|
Bytea: re.compile(r"'(?P<value>.*)'::bytea$"),
|
@@ -373,7 +373,7 @@ COLUMN_DEFAULT_PARSER = {
|
|
373
373
|
}
|
374
374
|
|
375
375
|
# Re-map for Cockroach compatibility.
|
376
|
-
COLUMN_DEFAULT_PARSER_COCKROACH = {
|
376
|
+
COLUMN_DEFAULT_PARSER_COCKROACH: t.Dict[t.Type[Column], t.Any] = {
|
377
377
|
**COLUMN_DEFAULT_PARSER,
|
378
378
|
BigInt: re.compile(r"^(?P<value>-?\d+)$"),
|
379
379
|
}
|
@@ -24,7 +24,7 @@ def start_ipython_shell(**tables: t.Type[Table]): # pragma: no cover
|
|
24
24
|
if table_class_name not in existing_global_names:
|
25
25
|
globals()[table_class_name] = table_class
|
26
26
|
|
27
|
-
IPython.embed(using=_asyncio_runner, colors="neutral")
|
27
|
+
IPython.embed(using=_asyncio_runner, colors="neutral") # type: ignore
|
28
28
|
|
29
29
|
|
30
30
|
def run() -> None:
|
@@ -830,7 +830,11 @@ class Column(Selectable):
|
|
830
830
|
engine_type=engine_type, with_alias=False
|
831
831
|
)
|
832
832
|
|
833
|
-
def get_sql_value(
|
833
|
+
def get_sql_value(
|
834
|
+
self,
|
835
|
+
value: t.Any,
|
836
|
+
delimiter: str = "'",
|
837
|
+
) -> str:
|
834
838
|
"""
|
835
839
|
When using DDL statements, we can't parameterise the values. An example
|
836
840
|
is when setting the default for a column. So we have to convert from
|
@@ -839,11 +843,18 @@ class Column(Selectable):
|
|
839
843
|
|
840
844
|
:param value:
|
841
845
|
The Python value to convert to a string usable in a DDL statement
|
842
|
-
e.g. 1
|
846
|
+
e.g. ``1``.
|
847
|
+
:param delimiter:
|
848
|
+
The string returned by this function is wrapped in delimiters,
|
849
|
+
ready to be added to a DDL statement. For example:
|
850
|
+
``'hello world'``.
|
843
851
|
:returns:
|
844
|
-
The string usable in the DDL statement e.g. '1'
|
852
|
+
The string usable in the DDL statement e.g. ``'1'``.
|
845
853
|
|
846
854
|
"""
|
855
|
+
from piccolo.engine.sqlite import ADAPTERS as sqlite_adapters
|
856
|
+
|
857
|
+
# Common across all DB engines
|
847
858
|
if isinstance(value, Default):
|
848
859
|
return getattr(value, self._meta.engine_type)
|
849
860
|
elif value is None:
|
@@ -851,37 +862,52 @@ class Column(Selectable):
|
|
851
862
|
elif isinstance(value, (float, decimal.Decimal)):
|
852
863
|
return str(value)
|
853
864
|
elif isinstance(value, str):
|
854
|
-
return f"
|
865
|
+
return f"{delimiter}{value}{delimiter}"
|
855
866
|
elif isinstance(value, bool):
|
856
867
|
return str(value).lower()
|
857
|
-
elif isinstance(value, datetime.datetime):
|
858
|
-
return f"'{value.isoformat().replace('T', ' ')}'"
|
859
|
-
elif isinstance(value, datetime.date):
|
860
|
-
return f"'{value.isoformat()}'"
|
861
|
-
elif isinstance(value, datetime.time):
|
862
|
-
return f"'{value.isoformat()}'"
|
863
|
-
elif isinstance(value, datetime.timedelta):
|
864
|
-
interval = IntervalCustom.from_timedelta(value)
|
865
|
-
return getattr(interval, self._meta.engine_type)
|
866
868
|
elif isinstance(value, bytes):
|
867
|
-
return f"
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
(
|
876
|
-
|
877
|
-
|
878
|
-
|
869
|
+
return f"{delimiter}{value.hex()}{delimiter}"
|
870
|
+
|
871
|
+
# SQLite specific
|
872
|
+
if self._meta.engine_type == "sqlite":
|
873
|
+
if adapter := sqlite_adapters.get(type(value)):
|
874
|
+
sqlite_value = adapter(value)
|
875
|
+
return (
|
876
|
+
f"{delimiter}{sqlite_value}{delimiter}"
|
877
|
+
if isinstance(sqlite_value, str)
|
878
|
+
else sqlite_value
|
879
|
+
)
|
880
|
+
|
881
|
+
# Postgres and Cockroach
|
882
|
+
if self._meta.engine_type in ["postgres", "cockroach"]:
|
883
|
+
if isinstance(value, datetime.datetime):
|
884
|
+
return f"{delimiter}{value.isoformat().replace('T', ' ')}{delimiter}" # noqa: E501
|
885
|
+
elif isinstance(value, datetime.date):
|
886
|
+
return f"{delimiter}{value.isoformat()}{delimiter}"
|
887
|
+
elif isinstance(value, datetime.time):
|
888
|
+
return f"{delimiter}{value.isoformat()}{delimiter}"
|
889
|
+
elif isinstance(value, datetime.timedelta):
|
890
|
+
interval = IntervalCustom.from_timedelta(value)
|
891
|
+
return getattr(interval, self._meta.engine_type)
|
892
|
+
elif isinstance(value, uuid.UUID):
|
893
|
+
return f"{delimiter}{value}{delimiter}"
|
894
|
+
elif isinstance(value, list):
|
895
|
+
# Convert to the array syntax.
|
896
|
+
return (
|
897
|
+
delimiter
|
898
|
+
+ "{"
|
899
|
+
+ ",".join(
|
900
|
+
self.get_sql_value(
|
901
|
+
i,
|
902
|
+
delimiter="" if isinstance(i, list) else '"',
|
903
|
+
)
|
904
|
+
for i in value
|
879
905
|
)
|
880
|
-
|
906
|
+
+ "}"
|
907
|
+
+ delimiter
|
881
908
|
)
|
882
|
-
|
883
|
-
|
884
|
-
return value
|
909
|
+
|
910
|
+
return str(value)
|
885
911
|
|
886
912
|
@property
|
887
913
|
def column_type(self):
|
@@ -57,7 +57,11 @@ from piccolo.columns.defaults.timestamptz import (
|
|
57
57
|
TimestamptzNow,
|
58
58
|
)
|
59
59
|
from piccolo.columns.defaults.uuid import UUID4, UUIDArg
|
60
|
-
from piccolo.columns.operators.comparison import
|
60
|
+
from piccolo.columns.operators.comparison import (
|
61
|
+
ArrayAll,
|
62
|
+
ArrayAny,
|
63
|
+
ArrayNotAny,
|
64
|
+
)
|
61
65
|
from piccolo.columns.operators.string import Concat
|
62
66
|
from piccolo.columns.reference import LazyTableReference
|
63
67
|
from piccolo.querystring import QueryString
|
@@ -1952,7 +1956,9 @@ class ForeignKey(Column, t.Generic[ReferencedTable]):
|
|
1952
1956
|
|
1953
1957
|
if is_table_class:
|
1954
1958
|
# Record the reverse relationship on the target table.
|
1955
|
-
|
1959
|
+
t.cast(
|
1960
|
+
t.Type[Table], references
|
1961
|
+
)._meta._foreign_key_references.append(self)
|
1956
1962
|
|
1957
1963
|
# Allow columns on the referenced table to be accessed via
|
1958
1964
|
# auto completion.
|
@@ -2670,6 +2676,24 @@ class Array(Column):
|
|
2670
2676
|
else:
|
2671
2677
|
raise ValueError("Unrecognised engine type")
|
2672
2678
|
|
2679
|
+
def not_any(self, value: t.Any) -> Where:
|
2680
|
+
"""
|
2681
|
+
Check if the given value isn't in the array.
|
2682
|
+
|
2683
|
+
.. code-block:: python
|
2684
|
+
|
2685
|
+
>>> await Ticket.select().where(Ticket.seat_numbers.not_any(510))
|
2686
|
+
|
2687
|
+
"""
|
2688
|
+
engine_type = self._meta.engine_type
|
2689
|
+
|
2690
|
+
if engine_type in ("postgres", "cockroach"):
|
2691
|
+
return Where(column=self, value=value, operator=ArrayNotAny)
|
2692
|
+
elif engine_type == "sqlite":
|
2693
|
+
return self.not_like(f"%{value}%")
|
2694
|
+
else:
|
2695
|
+
raise ValueError("Unrecognised engine type")
|
2696
|
+
|
2673
2697
|
def all(self, value: t.Any) -> Where:
|
2674
2698
|
"""
|
2675
2699
|
Check if all of the items in the array match the given value.
|
@@ -2688,7 +2712,7 @@ class Array(Column):
|
|
2688
2712
|
else:
|
2689
2713
|
raise ValueError("Unrecognised engine type")
|
2690
2714
|
|
2691
|
-
def cat(self, value: t.List[t.Any]) -> QueryString:
|
2715
|
+
def cat(self, value: t.Union[t.Any, t.List[t.Any]]) -> QueryString:
|
2692
2716
|
"""
|
2693
2717
|
Used in an ``update`` query to append items to an array.
|
2694
2718
|
|
@@ -2719,7 +2743,7 @@ class Array(Column):
|
|
2719
2743
|
db_column_name = self._meta.db_column_name
|
2720
2744
|
return QueryString(f'array_cat("{db_column_name}", {{}})', value)
|
2721
2745
|
|
2722
|
-
def __add__(self, value: t.List[t.Any]) -> QueryString:
|
2746
|
+
def __add__(self, value: t.Union[t.Any, t.List[t.Any]]) -> QueryString:
|
2723
2747
|
return self.cat(value)
|
2724
2748
|
|
2725
2749
|
###########################################################################
|
@@ -1,22 +1,24 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import typing as t
|
4
|
-
from abc import ABC, abstractmethod
|
4
|
+
from abc import ABC, abstractmethod
|
5
5
|
|
6
6
|
from piccolo.utils.repr import repr_class_instance
|
7
7
|
|
8
8
|
|
9
9
|
class Default(ABC):
|
10
|
-
@
|
10
|
+
@property
|
11
|
+
@abstractmethod
|
11
12
|
def postgres(self) -> str:
|
12
13
|
pass
|
13
14
|
|
14
|
-
@
|
15
|
+
@property
|
16
|
+
@abstractmethod
|
15
17
|
def sqlite(self) -> str:
|
16
18
|
pass
|
17
19
|
|
18
20
|
@abstractmethod
|
19
|
-
def python(self):
|
21
|
+
def python(self) -> t.Any:
|
20
22
|
pass
|
21
23
|
|
22
24
|
def get_postgres_interval_string(self, attributes: t.List[str]) -> str:
|
@@ -102,7 +102,15 @@ class DateCustom(Default):
|
|
102
102
|
|
103
103
|
|
104
104
|
# Might add an enum back which encapsulates all of the options.
|
105
|
-
DateArg = t.Union[
|
105
|
+
DateArg = t.Union[
|
106
|
+
DateOffset,
|
107
|
+
DateCustom,
|
108
|
+
DateNow,
|
109
|
+
Enum,
|
110
|
+
None,
|
111
|
+
datetime.date,
|
112
|
+
t.Callable[[], datetime.date],
|
113
|
+
]
|
106
114
|
|
107
115
|
|
108
116
|
__all__ = ["DateArg", "DateOffset", "DateCustom", "DateNow"]
|
@@ -89,7 +89,15 @@ class TimeCustom(Default):
|
|
89
89
|
)
|
90
90
|
|
91
91
|
|
92
|
-
TimeArg = t.Union[
|
92
|
+
TimeArg = t.Union[
|
93
|
+
TimeCustom,
|
94
|
+
TimeNow,
|
95
|
+
TimeOffset,
|
96
|
+
Enum,
|
97
|
+
None,
|
98
|
+
datetime.time,
|
99
|
+
t.Callable[[], datetime.time],
|
100
|
+
]
|
93
101
|
|
94
102
|
|
95
103
|
__all__ = ["TimeArg", "TimeCustom", "TimeNow", "TimeOffset"]
|
@@ -131,6 +131,7 @@ class M2MSelect(Selectable):
|
|
131
131
|
if len(self.columns) > 1 or not self.serialisation_safe:
|
132
132
|
column_name = table_2_pk_name
|
133
133
|
else:
|
134
|
+
assert len(self.columns) > 0
|
134
135
|
column_name = self.columns[0]._meta.db_column_name
|
135
136
|
|
136
137
|
return QueryString(
|
@@ -256,15 +257,14 @@ class M2MMeta:
|
|
256
257
|
|
257
258
|
@dataclass
|
258
259
|
class M2MAddRelated:
|
259
|
-
|
260
260
|
target_row: Table
|
261
261
|
m2m: M2M
|
262
262
|
rows: t.Sequence[Table]
|
263
263
|
extra_column_values: t.Dict[t.Union[Column, str], t.Any]
|
264
264
|
|
265
|
-
|
266
|
-
|
267
|
-
|
265
|
+
@property
|
266
|
+
def resolved_extra_column_values(self) -> t.Dict[str, t.Any]:
|
267
|
+
return {
|
268
268
|
i._meta.name if isinstance(i, Column) else i: j
|
269
269
|
for i, j in self.extra_column_values.items()
|
270
270
|
}
|
@@ -281,7 +281,9 @@ class M2MAddRelated:
|
|
281
281
|
joining_table_rows = []
|
282
282
|
|
283
283
|
for row in rows:
|
284
|
-
joining_table_row = joining_table(
|
284
|
+
joining_table_row = joining_table(
|
285
|
+
**self.resolved_extra_column_values
|
286
|
+
)
|
285
287
|
setattr(
|
286
288
|
joining_table_row,
|
287
289
|
self.m2m._meta.primary_foreign_key._meta.name,
|
@@ -323,7 +325,6 @@ class M2MAddRelated:
|
|
323
325
|
|
324
326
|
@dataclass
|
325
327
|
class M2MRemoveRelated:
|
326
|
-
|
327
328
|
target_row: Table
|
328
329
|
m2m: M2M
|
329
330
|
rows: t.Sequence[Table]
|
@@ -363,7 +364,6 @@ class M2MRemoveRelated:
|
|
363
364
|
|
364
365
|
@dataclass
|
365
366
|
class M2MGetRelated:
|
366
|
-
|
367
367
|
row: Table
|
368
368
|
m2m: M2M
|
369
369
|
|
@@ -157,17 +157,22 @@ class AppConfig:
|
|
157
157
|
"""
|
158
158
|
|
159
159
|
app_name: str
|
160
|
-
migrations_folder_path: str
|
160
|
+
migrations_folder_path: t.Union[str, pathlib.Path]
|
161
161
|
table_classes: t.List[t.Type[Table]] = field(default_factory=list)
|
162
162
|
migration_dependencies: t.List[str] = field(default_factory=list)
|
163
163
|
commands: t.List[t.Union[t.Callable, Command]] = field(
|
164
164
|
default_factory=list
|
165
165
|
)
|
166
166
|
|
167
|
-
|
168
|
-
|
169
|
-
|
167
|
+
@property
|
168
|
+
def resolved_migrations_folder_path(self) -> str:
|
169
|
+
return (
|
170
|
+
str(self.migrations_folder_path)
|
171
|
+
if isinstance(self.migrations_folder_path, pathlib.Path)
|
172
|
+
else self.migrations_folder_path
|
173
|
+
)
|
170
174
|
|
175
|
+
def __post_init__(self) -> None:
|
171
176
|
self._migration_dependency_app_configs: t.Optional[
|
172
177
|
t.List[AppConfig]
|
173
178
|
] = None
|
@@ -7,12 +7,14 @@ import string
|
|
7
7
|
import typing as t
|
8
8
|
from abc import ABCMeta, abstractmethod
|
9
9
|
|
10
|
+
from typing_extensions import Self
|
11
|
+
|
10
12
|
from piccolo.querystring import QueryString
|
11
13
|
from piccolo.utils.sync import run_sync
|
12
14
|
from piccolo.utils.warnings import Level, colored_string, colored_warning
|
13
15
|
|
14
16
|
if t.TYPE_CHECKING: # pragma: no cover
|
15
|
-
from piccolo.query.base import Query
|
17
|
+
from piccolo.query.base import DDL, Query
|
16
18
|
|
17
19
|
|
18
20
|
logger = logging.getLogger(__name__)
|
@@ -32,31 +34,76 @@ def validate_savepoint_name(savepoint_name: str) -> None:
|
|
32
34
|
)
|
33
35
|
|
34
36
|
|
35
|
-
class
|
36
|
-
|
37
|
+
class BaseBatch(metaclass=ABCMeta):
|
38
|
+
@abstractmethod
|
39
|
+
async def __aenter__(self: Self, *args, **kwargs) -> Self: ...
|
37
40
|
|
41
|
+
@abstractmethod
|
42
|
+
async def __aexit__(self, *args, **kwargs): ...
|
38
43
|
|
39
|
-
|
44
|
+
@abstractmethod
|
45
|
+
def __aiter__(self: Self) -> Self: ...
|
40
46
|
|
47
|
+
@abstractmethod
|
48
|
+
async def __anext__(self) -> t.List[t.Dict]: ...
|
41
49
|
|
42
|
-
class Engine(t.Generic[TransactionClass], metaclass=ABCMeta):
|
43
50
|
|
44
|
-
|
51
|
+
class BaseTransaction(metaclass=ABCMeta):
|
45
52
|
|
46
|
-
|
47
|
-
run_sync(self.check_version())
|
48
|
-
run_sync(self.prep_database())
|
49
|
-
self.query_id = 0
|
53
|
+
__slots__: t.Tuple[str, ...] = tuple()
|
50
54
|
|
51
|
-
@property
|
52
55
|
@abstractmethod
|
53
|
-
def
|
54
|
-
pass
|
56
|
+
async def __aenter__(self, *args, **kwargs): ...
|
55
57
|
|
56
|
-
@property
|
57
58
|
@abstractmethod
|
58
|
-
def
|
59
|
-
|
59
|
+
async def __aexit__(self, *args, **kwargs) -> bool: ...
|
60
|
+
|
61
|
+
|
62
|
+
class BaseAtomic(metaclass=ABCMeta):
|
63
|
+
|
64
|
+
__slots__: t.Tuple[str, ...] = tuple()
|
65
|
+
|
66
|
+
@abstractmethod
|
67
|
+
def add(self, *query: t.Union[Query, DDL]): ...
|
68
|
+
|
69
|
+
@abstractmethod
|
70
|
+
async def run(self): ...
|
71
|
+
|
72
|
+
@abstractmethod
|
73
|
+
def run_sync(self): ...
|
74
|
+
|
75
|
+
@abstractmethod
|
76
|
+
def __await__(self): ...
|
77
|
+
|
78
|
+
|
79
|
+
TransactionClass = t.TypeVar("TransactionClass", bound=BaseTransaction)
|
80
|
+
|
81
|
+
|
82
|
+
class Engine(t.Generic[TransactionClass], metaclass=ABCMeta):
|
83
|
+
__slots__ = (
|
84
|
+
"query_id",
|
85
|
+
"log_queries",
|
86
|
+
"log_responses",
|
87
|
+
"engine_type",
|
88
|
+
"min_version_number",
|
89
|
+
"current_transaction",
|
90
|
+
)
|
91
|
+
|
92
|
+
def __init__(
|
93
|
+
self,
|
94
|
+
engine_type: str,
|
95
|
+
min_version_number: t.Union[int, float],
|
96
|
+
log_queries: bool = False,
|
97
|
+
log_responses: bool = False,
|
98
|
+
):
|
99
|
+
self.log_queries = log_queries
|
100
|
+
self.log_responses = log_responses
|
101
|
+
self.engine_type = engine_type
|
102
|
+
self.min_version_number = min_version_number
|
103
|
+
|
104
|
+
run_sync(self.check_version())
|
105
|
+
run_sync(self.prep_database())
|
106
|
+
self.query_id = 0
|
60
107
|
|
61
108
|
@abstractmethod
|
62
109
|
async def get_version(self) -> float:
|
@@ -76,11 +123,13 @@ class Engine(t.Generic[TransactionClass], metaclass=ABCMeta):
|
|
76
123
|
query: Query,
|
77
124
|
batch_size: int = 100,
|
78
125
|
node: t.Optional[str] = None,
|
79
|
-
) ->
|
126
|
+
) -> BaseBatch:
|
80
127
|
pass
|
81
128
|
|
82
129
|
@abstractmethod
|
83
|
-
async def run_querystring(
|
130
|
+
async def run_querystring(
|
131
|
+
self, querystring: QueryString, in_pool: bool = True
|
132
|
+
):
|
84
133
|
pass
|
85
134
|
|
86
135
|
@abstractmethod
|
@@ -88,11 +137,11 @@ class Engine(t.Generic[TransactionClass], metaclass=ABCMeta):
|
|
88
137
|
pass
|
89
138
|
|
90
139
|
@abstractmethod
|
91
|
-
def transaction(self):
|
140
|
+
def transaction(self, *args, **kwargs) -> TransactionClass:
|
92
141
|
pass
|
93
142
|
|
94
143
|
@abstractmethod
|
95
|
-
def atomic(self):
|
144
|
+
def atomic(self) -> BaseAtomic:
|
96
145
|
pass
|
97
146
|
|
98
147
|
async def check_version(self):
|
@@ -16,9 +16,6 @@ class CockroachEngine(PostgresEngine):
|
|
16
16
|
:class:`PostgresEngine <piccolo.engine.postgres.PostgresEngine>`.
|
17
17
|
"""
|
18
18
|
|
19
|
-
engine_type = "cockroach"
|
20
|
-
min_version_number = 0 # Doesn't seem to work with cockroach versioning.
|
21
|
-
|
22
19
|
def __init__(
|
23
20
|
self,
|
24
21
|
config: t.Dict[str, t.Any],
|
@@ -34,6 +31,8 @@ class CockroachEngine(PostgresEngine):
|
|
34
31
|
log_responses=log_responses,
|
35
32
|
extra_nodes=extra_nodes,
|
36
33
|
)
|
34
|
+
self.engine_type = "cockroach"
|
35
|
+
self.min_version_number = 0
|
37
36
|
|
38
37
|
async def prep_database(self):
|
39
38
|
try:
|