piccolo 1.11.0__tar.gz → 1.12.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.11.0 → piccolo-1.12.0}/PKG-INFO +1 -1
- piccolo-1.12.0/piccolo/__init__.py +1 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja +35 -30
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/_starlette_app.py.jinja +29 -21
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/auto/migration_manager.py +1 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/commands/forwards.py +8 -7
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/playground/commands/run.py +11 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/column_types.py +55 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo.egg-info/PKG-INFO +1 -1
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/commands/test_forwards_backwards.py +32 -1
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_array.py +3 -7
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_bigint.py +3 -9
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_boolean.py +3 -7
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_bytea.py +5 -14
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_choices.py +5 -14
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_date.py +5 -13
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_double_precision.py +3 -8
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_interval.py +5 -13
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_json.py +9 -26
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_jsonb.py +3 -11
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_numeric.py +3 -7
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_primary_key.py +11 -33
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_readable.py +5 -7
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_real.py +3 -8
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_reserved_column_names.py +3 -8
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_smallint.py +3 -8
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_time.py +5 -14
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_timestamp.py +5 -13
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_timestamptz.py +5 -13
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_uuid.py +3 -7
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_varchar.py +3 -9
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/functions/base.py +2 -15
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/functions/test_datetime.py +2 -4
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/functions/test_math.py +2 -3
- piccolo-1.11.0/piccolo/__init__.py +0 -1
- {piccolo-1.11.0 → piccolo-1.12.0}/LICENSE +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/README.md +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/app/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/app/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/app/commands/new.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/app/commands/show_all.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/app/commands/templates/piccolo_app.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/app/commands/templates/tables.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/app/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/new.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/README.md.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/_blacksheep_app.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/_lilya_app.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/_litestar_app.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/app.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/conftest.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/__init__.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/_blacksheep_endpoints.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/_esmerald_endpoints.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/_lilya_endpoints.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/_litestar_endpoints.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/_starlette_endpoints.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/endpoints.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_app.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_migrations/README.md +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/tables.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/templates/base.html.jinja_raw +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/home/templates/home.html.jinja_raw +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/main.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf_test.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/static/favicon.ico +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/static/main.css +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/fixtures/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/fixtures/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/fixtures/commands/dump.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/fixtures/commands/load.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/fixtures/commands/shared.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/fixtures/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/meta/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/meta/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/meta/commands/version.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/meta/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/auto/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/auto/diffable_table.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/auto/operations.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/auto/schema_differ.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/auto/schema_snapshot.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/auto/serialisation.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/auto/serialisation_legacy.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/commands/backwards.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/commands/base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/commands/check.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/commands/clean.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/commands/new.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/commands/templates/migration.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/migrations/tables.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/playground/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/playground/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/playground/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/project/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/project/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/project/commands/new.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/project/commands/templates/piccolo_conf.py.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/project/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/schema/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/schema/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/schema/commands/exceptions.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/schema/commands/generate.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/schema/commands/graph.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/schema/commands/templates/graphviz.dot.jinja +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/schema/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/shell/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/shell/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/shell/commands/run.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/shell/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/sql_shell/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/sql_shell/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/sql_shell/commands/run.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/sql_shell/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/tester/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/tester/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/tester/commands/run.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/tester/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/commands/change_password.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/commands/change_permissions.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/commands/create.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/commands/list.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/piccolo_migrations/2019-11-14T21-52-21.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/piccolo_migrations/2020-06-11T21-38-55.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/piccolo_migrations/2021-04-30T16-14-15.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/piccolo_migrations/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/user/tables.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/choices.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/combination.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/defaults/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/defaults/base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/defaults/date.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/defaults/interval.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/defaults/time.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/defaults/timestamp.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/defaults/timestamptz.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/defaults/uuid.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/indexes.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/m2m.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/operators/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/operators/base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/operators/comparison.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/operators/math.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/operators/string.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/readable.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/columns/reference.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/conf/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/conf/apps.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/custom_types.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/engine/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/engine/base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/engine/cockroach.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/engine/exceptions.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/engine/finder.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/engine/postgres.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/engine/sqlite.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/main.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/py.typed +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/functions/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/functions/aggregate.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/functions/base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/functions/datetime.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/functions/math.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/functions/string.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/functions/type_conversion.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/alter.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/count.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/create.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/create_index.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/delete.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/drop_index.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/exists.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/indexes.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/insert.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/objects.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/raw.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/refresh.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/select.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/table_exists.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/methods/update.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/mixins.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/query/proxy.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/querystring.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/schema.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/table.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/table_reflection.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/testing/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/testing/model_builder.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/testing/random_builder.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/dictionary.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/encoding.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/graphlib/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/graphlib/_graphlib.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/lazy_loader.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/list.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/naming.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/objects.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/printing.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/pydantic.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/repr.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/sql_values.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/sync.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo/utils/warnings.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo.egg-info/SOURCES.txt +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo.egg-info/dependency_links.txt +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo.egg-info/entry_points.txt +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo.egg-info/requires.txt +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/piccolo.egg-info/top_level.txt +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/profiling/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/profiling/run_profile.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/pyproject.toml +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/setup.cfg +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/setup.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/app/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/app/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/app/commands/test_new.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/app/commands/test_show_all.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/asgi/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/asgi/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/asgi/commands/test_new.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/fixtures/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/fixtures/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/fixtures/commands/test_dump_load.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/fixtures/commands/test_shared.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/meta/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/meta/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/meta/commands/test_version.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/auto/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/auto/integration/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/auto/integration/test_migrations.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/auto/test_diffable_table.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/auto/test_migration_manager.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/auto/test_schema_differ.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/auto/test_schema_snapshot.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/auto/test_serialisation.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/commands/test_base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/commands/test_check.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/commands/test_clean.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/commands/test_migrations/2020-03-31T20-38-22.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/commands/test_migrations/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/commands/test_new.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/migrations/test_migration.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/project/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/project/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/project/commands/test_new.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/schema/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/shell/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/shell/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/shell/commands/test_run.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/sql_shell/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/sql_shell/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/sql_shell/commands/test_run.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/tester/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/user/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/user/commands/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/user/commands/test_change_password.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/user/commands/test_change_permissions.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/user/commands/test_create.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/user/commands/test_list.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/apps/user/test_tables.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/m2m/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/m2m/base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/m2m/test_m2m.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/m2m/test_m2m_schema.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_base.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_combination.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_db_column_name.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_defaults.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_get_sql_value.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/columns/test_reference.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/conf/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/conf/example.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/conf/test_apps.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/engine/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/engine/test_extra_nodes.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/engine/test_logging.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/engine/test_nested_transaction.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/engine/test_pool.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/engine/test_transaction.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/engine/test_version_parsing.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/mega/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/mega/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/mega/piccolo_migrations/2021-09-20T21-23-25-698988.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/mega/piccolo_migrations/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/mega/tables.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/music/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/music/piccolo_app.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/music/tables.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/example_apps/music/tables_detailed.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/functions/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/functions/test_functions.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/functions/test_string.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/functions/test_type_conversion.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/mixins/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/mixins/test_columns_delegate.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/mixins/test_order_by_delegate.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/test_await.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/test_camelcase.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/test_freeze.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/test_gather.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/test_querystring.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/query/test_slots.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/instance/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/instance/test_create.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/instance/test_get_related.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/instance/test_get_related_readable.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/instance/test_instantiate.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/instance/test_remove.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/instance/test_save.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/instance/test_to_dict.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_all_columns.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_alter.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_batch.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_callback.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_constructor.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_count.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_create.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_create_db_tables.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_create_table_class.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_delete.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_drop_db_tables.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_exists.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_from_dict.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_indexes.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_inheritance.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_insert.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_join.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_join_on.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_metaclass.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_objects.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_output.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_raw.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_ref.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_refresh.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_repr.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_select.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_str.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_table_exists.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/table/test_update.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/test_main.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/test_schema.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/testing/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/testing/test_model_builder.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/testing/test_random_builder.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/__init__.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_dictionary.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_encoding.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_lazy_loader.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_list.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_naming.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_printing.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_pydantic.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_sql_values.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_sync.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_table_reflection.py +0 -0
- {piccolo-1.11.0 → piccolo-1.12.0}/tests/utils/test_warnings.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__VERSION__ = "1.12.0"
|
{piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja
RENAMED
@@ -1,11 +1,12 @@
|
|
1
1
|
import typing as t
|
2
|
+
from contextlib import asynccontextmanager
|
2
3
|
|
3
4
|
from fastapi import FastAPI
|
4
5
|
from fastapi.responses import JSONResponse
|
6
|
+
from piccolo.engine import engine_finder
|
5
7
|
from piccolo_admin.endpoints import create_admin
|
6
8
|
from piccolo_api.crud.serializers import create_pydantic_model
|
7
|
-
from
|
8
|
-
from starlette.routing import Route, Mount
|
9
|
+
from starlette.routing import Mount, Route
|
9
10
|
from starlette.staticfiles import StaticFiles
|
10
11
|
|
11
12
|
from home.endpoints import HomeEndpoint
|
@@ -13,6 +14,29 @@ from home.piccolo_app import APP_CONFIG
|
|
13
14
|
from home.tables import Task
|
14
15
|
|
15
16
|
|
17
|
+
async def open_database_connection_pool():
|
18
|
+
try:
|
19
|
+
engine = engine_finder()
|
20
|
+
await engine.start_connection_pool()
|
21
|
+
except Exception:
|
22
|
+
print("Unable to connect to the database")
|
23
|
+
|
24
|
+
|
25
|
+
async def close_database_connection_pool():
|
26
|
+
try:
|
27
|
+
engine = engine_finder()
|
28
|
+
await engine.close_connection_pool()
|
29
|
+
except Exception:
|
30
|
+
print("Unable to connect to the database")
|
31
|
+
|
32
|
+
|
33
|
+
@asynccontextmanager
|
34
|
+
async def lifespan(app: FastAPI):
|
35
|
+
await open_database_connection_pool()
|
36
|
+
yield
|
37
|
+
await close_database_connection_pool()
|
38
|
+
|
39
|
+
|
16
40
|
app = FastAPI(
|
17
41
|
routes=[
|
18
42
|
Route("/", HomeEndpoint),
|
@@ -22,21 +46,20 @@ app = FastAPI(
|
|
22
46
|
tables=APP_CONFIG.table_classes,
|
23
47
|
# Required when running under HTTPS:
|
24
48
|
# allowed_hosts=['my_site.com']
|
25
|
-
)
|
49
|
+
),
|
26
50
|
),
|
27
51
|
Mount("/static/", StaticFiles(directory="static")),
|
28
52
|
],
|
53
|
+
lifespan=lifespan,
|
29
54
|
)
|
30
55
|
|
31
56
|
|
32
57
|
TaskModelIn: t.Any = create_pydantic_model(
|
33
58
|
table=Task,
|
34
|
-
model_name=
|
59
|
+
model_name="TaskModelIn",
|
35
60
|
)
|
36
61
|
TaskModelOut: t.Any = create_pydantic_model(
|
37
|
-
table=Task,
|
38
|
-
include_default_columns=True,
|
39
|
-
model_name='TaskModelOut'
|
62
|
+
table=Task, include_default_columns=True, model_name="TaskModelOut"
|
40
63
|
)
|
41
64
|
|
42
65
|
|
@@ -45,16 +68,16 @@ async def tasks():
|
|
45
68
|
return await Task.select().order_by(Task.id)
|
46
69
|
|
47
70
|
|
48
|
-
@app.post(
|
71
|
+
@app.post("/tasks/", response_model=TaskModelOut)
|
49
72
|
async def create_task(task_model: TaskModelIn):
|
50
73
|
task = Task(**task_model.dict())
|
51
74
|
await task.save()
|
52
75
|
return task.to_dict()
|
53
76
|
|
54
77
|
|
55
|
-
@app.put(
|
78
|
+
@app.put("/tasks/{task_id}/", response_model=TaskModelOut)
|
56
79
|
async def update_task(task_id: int, task_model: TaskModelIn):
|
57
|
-
task = await Task.objects().get(Task.
|
80
|
+
task = await Task.objects().get(Task._meta.primary_key == task_id)
|
58
81
|
if not task:
|
59
82
|
return JSONResponse({}, status_code=404)
|
60
83
|
|
@@ -66,30 +89,12 @@ async def update_task(task_id: int, task_model: TaskModelIn):
|
|
66
89
|
return task.to_dict()
|
67
90
|
|
68
91
|
|
69
|
-
@app.delete(
|
92
|
+
@app.delete("/tasks/{task_id}/")
|
70
93
|
async def delete_task(task_id: int):
|
71
|
-
task = await Task.objects().get(Task.
|
94
|
+
task = await Task.objects().get(Task._meta.primary_key == task_id)
|
72
95
|
if not task:
|
73
96
|
return JSONResponse({}, status_code=404)
|
74
97
|
|
75
98
|
await task.remove()
|
76
99
|
|
77
100
|
return JSONResponse({})
|
78
|
-
|
79
|
-
|
80
|
-
@app.on_event("startup")
|
81
|
-
async def open_database_connection_pool():
|
82
|
-
try:
|
83
|
-
engine = engine_finder()
|
84
|
-
await engine.start_connection_pool()
|
85
|
-
except Exception:
|
86
|
-
print("Unable to connect to the database")
|
87
|
-
|
88
|
-
|
89
|
-
@app.on_event("shutdown")
|
90
|
-
async def close_database_connection_pool():
|
91
|
-
try:
|
92
|
-
engine = engine_finder()
|
93
|
-
await engine.close_connection_pool()
|
94
|
-
except Exception:
|
95
|
-
print("Unable to connect to the database")
|
{piccolo-1.11.0 → piccolo-1.12.0}/piccolo/apps/asgi/commands/templates/app/_starlette_app.py.jinja
RENAMED
@@ -1,8 +1,10 @@
|
|
1
|
+
from contextlib import asynccontextmanager
|
2
|
+
|
3
|
+
from piccolo.engine import engine_finder
|
1
4
|
from piccolo_admin.endpoints import create_admin
|
2
5
|
from piccolo_api.crud.endpoints import PiccoloCRUD
|
3
|
-
from piccolo.engine import engine_finder
|
4
|
-
from starlette.routing import Route, Mount
|
5
6
|
from starlette.applications import Starlette
|
7
|
+
from starlette.routing import Mount, Route
|
6
8
|
from starlette.staticfiles import StaticFiles
|
7
9
|
|
8
10
|
from home.endpoints import HomeEndpoint
|
@@ -10,24 +12,6 @@ from home.piccolo_app import APP_CONFIG
|
|
10
12
|
from home.tables import Task
|
11
13
|
|
12
14
|
|
13
|
-
app = Starlette(
|
14
|
-
routes=[
|
15
|
-
Route("/", HomeEndpoint),
|
16
|
-
Mount(
|
17
|
-
"/admin/",
|
18
|
-
create_admin(
|
19
|
-
tables=APP_CONFIG.table_classes,
|
20
|
-
# Required when running under HTTPS:
|
21
|
-
# allowed_hosts=['my_site.com']
|
22
|
-
)
|
23
|
-
),
|
24
|
-
Mount("/static/", StaticFiles(directory="static")),
|
25
|
-
Mount("/tasks/", PiccoloCRUD(table=Task))
|
26
|
-
],
|
27
|
-
)
|
28
|
-
|
29
|
-
|
30
|
-
@app.on_event("startup")
|
31
15
|
async def open_database_connection_pool():
|
32
16
|
try:
|
33
17
|
engine = engine_finder()
|
@@ -36,10 +20,34 @@ async def open_database_connection_pool():
|
|
36
20
|
print("Unable to connect to the database")
|
37
21
|
|
38
22
|
|
39
|
-
@app.on_event("shutdown")
|
40
23
|
async def close_database_connection_pool():
|
41
24
|
try:
|
42
25
|
engine = engine_finder()
|
43
26
|
await engine.close_connection_pool()
|
44
27
|
except Exception:
|
45
28
|
print("Unable to connect to the database")
|
29
|
+
|
30
|
+
|
31
|
+
@asynccontextmanager
|
32
|
+
async def lifespan(app: Starlette):
|
33
|
+
await open_database_connection_pool()
|
34
|
+
yield
|
35
|
+
await close_database_connection_pool()
|
36
|
+
|
37
|
+
|
38
|
+
app = Starlette(
|
39
|
+
routes=[
|
40
|
+
Route("/", HomeEndpoint),
|
41
|
+
Mount(
|
42
|
+
"/admin/",
|
43
|
+
create_admin(
|
44
|
+
tables=APP_CONFIG.table_classes,
|
45
|
+
# Required when running under HTTPS:
|
46
|
+
# allowed_hosts=['my_site.com']
|
47
|
+
),
|
48
|
+
),
|
49
|
+
Mount("/static/", StaticFiles(directory="static")),
|
50
|
+
Mount("/tasks/", PiccoloCRUD(table=Task)),
|
51
|
+
],
|
52
|
+
lifespan=lifespan,
|
53
|
+
)
|
@@ -72,18 +72,19 @@ class ForwardsMigrationManager(BaseMigrationManager):
|
|
72
72
|
print(f"🚀 Running {n} migration{'s' if n != 1 else ''}:")
|
73
73
|
|
74
74
|
for _id in subset:
|
75
|
-
|
76
|
-
|
77
|
-
else:
|
78
|
-
migration_module = migration_modules[_id]
|
79
|
-
response = await migration_module.forwards()
|
75
|
+
migration_module = migration_modules[_id]
|
76
|
+
response = await migration_module.forwards()
|
80
77
|
|
81
|
-
|
78
|
+
if isinstance(response, MigrationManager):
|
79
|
+
if self.fake or response.fake:
|
80
|
+
print(f"- {_id}: faked! ⏭️")
|
81
|
+
else:
|
82
82
|
if self.preview:
|
83
83
|
response.preview = True
|
84
84
|
await response.run()
|
85
85
|
|
86
|
-
|
86
|
+
print("ok! ✔️")
|
87
|
+
|
87
88
|
if not self.preview:
|
88
89
|
await Migration.insert().add(
|
89
90
|
Migration(name=_id, app_name=app_config.app_name)
|
@@ -19,6 +19,7 @@ from piccolo.columns import (
|
|
19
19
|
Interval,
|
20
20
|
Numeric,
|
21
21
|
Serial,
|
22
|
+
Text,
|
22
23
|
Timestamp,
|
23
24
|
Varchar,
|
24
25
|
)
|
@@ -55,6 +56,12 @@ class Band(Table):
|
|
55
56
|
)
|
56
57
|
|
57
58
|
|
59
|
+
class FanClub(Table):
|
60
|
+
id: Serial
|
61
|
+
address = Text()
|
62
|
+
band = ForeignKey(Band, unique=True)
|
63
|
+
|
64
|
+
|
58
65
|
class Venue(Table):
|
59
66
|
id: Serial
|
60
67
|
name = Varchar(length=100)
|
@@ -154,6 +161,7 @@ class Album(Table):
|
|
154
161
|
TABLES = (
|
155
162
|
Manager,
|
156
163
|
Band,
|
164
|
+
FanClub,
|
157
165
|
Venue,
|
158
166
|
Concert,
|
159
167
|
Ticket,
|
@@ -185,6 +193,9 @@ def populate():
|
|
185
193
|
pythonistas = Band(name="Pythonistas", manager=guido.id, popularity=1000)
|
186
194
|
pythonistas.save().run_sync()
|
187
195
|
|
196
|
+
fan_club = FanClub(address="1 Flying Circus, UK", band=pythonistas)
|
197
|
+
fan_club.save().run_sync()
|
198
|
+
|
188
199
|
graydon = Manager(name="Graydon")
|
189
200
|
graydon.save().run_sync()
|
190
201
|
|
@@ -2016,6 +2016,61 @@ class ForeignKey(Column, t.Generic[ReferencedTable]):
|
|
2016
2016
|
if column._meta.name not in excluded_column_names
|
2017
2017
|
]
|
2018
2018
|
|
2019
|
+
def reverse(self) -> ForeignKey:
|
2020
|
+
"""
|
2021
|
+
If there's a unique foreign key, this function reverses it.
|
2022
|
+
|
2023
|
+
.. code-block:: python
|
2024
|
+
|
2025
|
+
class Band(Table):
|
2026
|
+
name = Varchar()
|
2027
|
+
|
2028
|
+
class FanClub(Table):
|
2029
|
+
band = ForeignKey(Band, unique=True)
|
2030
|
+
address = Text()
|
2031
|
+
|
2032
|
+
class Treasurer(Table):
|
2033
|
+
fan_club = ForeignKey(FanClub, unique=True)
|
2034
|
+
name = Varchar()
|
2035
|
+
|
2036
|
+
It's helpful with ``get_related``, for example:
|
2037
|
+
|
2038
|
+
.. code-block:: python
|
2039
|
+
|
2040
|
+
>>> band = await Band.objects().first()
|
2041
|
+
>>> await band.get_related(FanClub.band.reverse())
|
2042
|
+
<Fan Club: 1>
|
2043
|
+
|
2044
|
+
It works multiple levels deep:
|
2045
|
+
|
2046
|
+
.. code-block:: python
|
2047
|
+
|
2048
|
+
>>> await band.get_related(Treasurer.fan_club._.band.reverse())
|
2049
|
+
<Treasurer: 1>
|
2050
|
+
|
2051
|
+
"""
|
2052
|
+
if not self._meta.unique or any(
|
2053
|
+
not i._meta.unique for i in self._meta.call_chain
|
2054
|
+
):
|
2055
|
+
raise ValueError("Only reverse unique foreign keys.")
|
2056
|
+
|
2057
|
+
foreign_keys = [*self._meta.call_chain, self]
|
2058
|
+
|
2059
|
+
root_foreign_key = foreign_keys[0]
|
2060
|
+
target_column = (
|
2061
|
+
root_foreign_key._foreign_key_meta.resolved_target_column
|
2062
|
+
)
|
2063
|
+
foreign_key = target_column.join_on(root_foreign_key)
|
2064
|
+
|
2065
|
+
call_chain = []
|
2066
|
+
for fk in reversed(foreign_keys[1:]):
|
2067
|
+
target_column = fk._foreign_key_meta.resolved_target_column
|
2068
|
+
call_chain.append(target_column.join_on(fk))
|
2069
|
+
|
2070
|
+
foreign_key._meta.call_chain = call_chain
|
2071
|
+
|
2072
|
+
return foreign_key
|
2073
|
+
|
2019
2074
|
def all_related(
|
2020
2075
|
self, exclude: t.Optional[t.List[t.Union[ForeignKey, str]]] = None
|
2021
2076
|
) -> t.List[ForeignKey]:
|
@@ -192,7 +192,7 @@ class TestForwardsBackwards(TestCase):
|
|
192
192
|
@engines_only("postgres")
|
193
193
|
def test_forwards_fake(self):
|
194
194
|
"""
|
195
|
-
|
195
|
+
Make sure migrations can be faked on the command line.
|
196
196
|
"""
|
197
197
|
run_sync(forwards(app_name="music", migration_id="all", fake=True))
|
198
198
|
|
@@ -214,9 +214,40 @@ class TestForwardsBackwards(TestCase):
|
|
214
214
|
"2021-09-06T13:58:23:024723",
|
215
215
|
"2021-11-13T14:01:46:114725",
|
216
216
|
"2024-05-28T23:15:41:018844",
|
217
|
+
"2024-06-19T18:11:05:793132",
|
217
218
|
],
|
218
219
|
)
|
219
220
|
|
221
|
+
@engines_only("postgres")
|
222
|
+
@patch("piccolo.apps.migrations.commands.forwards.print")
|
223
|
+
def test_hardcoded_fake_migrations(self, print_: MagicMock):
|
224
|
+
"""
|
225
|
+
Make sure that migrations that have been hardcoded as fake aren't
|
226
|
+
executed, even without the ``--fake`` command line flag.
|
227
|
+
|
228
|
+
See tests/example_apps/music/piccolo_migrations/music_2024_06_19t18_11_05_793132.py
|
229
|
+
|
230
|
+
""" # noqa: E501
|
231
|
+
run_sync(forwards(app_name="music", migration_id="all"))
|
232
|
+
|
233
|
+
# The migration which is hardcoded as fake:
|
234
|
+
migration_name = "2024-06-19T18:11:05:793132"
|
235
|
+
|
236
|
+
self.assertTrue(
|
237
|
+
Migration.exists()
|
238
|
+
.where(Migration.name == migration_name)
|
239
|
+
.run_sync()
|
240
|
+
)
|
241
|
+
|
242
|
+
self.assertNotIn(
|
243
|
+
call("Running fake migration"),
|
244
|
+
print_.mock_calls,
|
245
|
+
)
|
246
|
+
self.assertIn(
|
247
|
+
call(f"- {migration_name}: faked! ⏭️"),
|
248
|
+
print_.mock_calls,
|
249
|
+
)
|
250
|
+
|
220
251
|
def tearDown(self):
|
221
252
|
for table_class in TABLE_CLASSES + [Migration]:
|
222
253
|
table_class.alter().drop_table(
|
@@ -14,7 +14,7 @@ from piccolo.columns.column_types import (
|
|
14
14
|
)
|
15
15
|
from piccolo.querystring import QueryString
|
16
16
|
from piccolo.table import Table
|
17
|
-
from tests.base import engines_only, engines_skip, sqlite_only
|
17
|
+
from tests.base import TableTest, engines_only, engines_skip, sqlite_only
|
18
18
|
|
19
19
|
|
20
20
|
class MyTable(Table):
|
@@ -32,16 +32,12 @@ class TestArrayDefault(TestCase):
|
|
32
32
|
self.assertTrue(column.default is list)
|
33
33
|
|
34
34
|
|
35
|
-
class TestArray(
|
35
|
+
class TestArray(TableTest):
|
36
36
|
"""
|
37
37
|
Make sure an Array column can be created, and works correctly.
|
38
38
|
"""
|
39
39
|
|
40
|
-
|
41
|
-
MyTable.create_table().run_sync()
|
42
|
-
|
43
|
-
def tearDown(self):
|
44
|
-
MyTable.alter().drop_table().run_sync()
|
40
|
+
tables = [MyTable]
|
45
41
|
|
46
42
|
@pytest.mark.cockroach_array_slow
|
47
43
|
def test_storage(self):
|
@@ -1,10 +1,8 @@
|
|
1
1
|
import os
|
2
|
-
from unittest import TestCase
|
3
2
|
|
4
3
|
from piccolo.columns.column_types import BigInt
|
5
4
|
from piccolo.table import Table
|
6
|
-
|
7
|
-
from ..base import engines_only
|
5
|
+
from tests.base import TableTest, engines_only
|
8
6
|
|
9
7
|
|
10
8
|
class MyTable(Table):
|
@@ -12,16 +10,12 @@ class MyTable(Table):
|
|
12
10
|
|
13
11
|
|
14
12
|
@engines_only("postgres", "cockroach")
|
15
|
-
class TestBigIntPostgres(
|
13
|
+
class TestBigIntPostgres(TableTest):
|
16
14
|
"""
|
17
15
|
Make sure a BigInt column in Postgres can store a large number.
|
18
16
|
"""
|
19
17
|
|
20
|
-
|
21
|
-
MyTable.create_table().run_sync()
|
22
|
-
|
23
|
-
def tearDown(self):
|
24
|
-
MyTable.alter().drop_table().run_sync()
|
18
|
+
tables = [MyTable]
|
25
19
|
|
26
20
|
def _test_length(self):
|
27
21
|
# Can store 8 bytes, but split between positive and negative values.
|
@@ -1,20 +1,16 @@
|
|
1
1
|
import typing as t
|
2
|
-
from unittest import TestCase
|
3
2
|
|
4
3
|
from piccolo.columns.column_types import Boolean
|
5
4
|
from piccolo.table import Table
|
5
|
+
from tests.base import TableTest
|
6
6
|
|
7
7
|
|
8
8
|
class MyTable(Table):
|
9
9
|
boolean = Boolean(boolean=False, null=True)
|
10
10
|
|
11
11
|
|
12
|
-
class TestBoolean(
|
13
|
-
|
14
|
-
MyTable.create_table().run_sync()
|
15
|
-
|
16
|
-
def tearDown(self):
|
17
|
-
MyTable.alter().drop_table().run_sync()
|
12
|
+
class TestBoolean(TableTest):
|
13
|
+
tables = [MyTable]
|
18
14
|
|
19
15
|
def test_return_type(self) -> None:
|
20
16
|
for value in (True, False, None, ...):
|
@@ -1,7 +1,6 @@
|
|
1
|
-
from unittest import TestCase
|
2
|
-
|
3
1
|
from piccolo.columns.column_types import Bytea
|
4
2
|
from piccolo.table import Table
|
3
|
+
from tests.base import TableTest
|
5
4
|
|
6
5
|
|
7
6
|
class MyTable(Table):
|
@@ -19,12 +18,8 @@ class MyTableDefault(Table):
|
|
19
18
|
token_none = Bytea(default=None, null=True)
|
20
19
|
|
21
20
|
|
22
|
-
class TestBytea(
|
23
|
-
|
24
|
-
MyTable.create_table().run_sync()
|
25
|
-
|
26
|
-
def tearDown(self):
|
27
|
-
MyTable.alter().drop_table().run_sync()
|
21
|
+
class TestBytea(TableTest):
|
22
|
+
tables = [MyTable]
|
28
23
|
|
29
24
|
def test_bytea(self):
|
30
25
|
"""
|
@@ -40,12 +35,8 @@ class TestBytea(TestCase):
|
|
40
35
|
)
|
41
36
|
|
42
37
|
|
43
|
-
class TestByteaDefault(
|
44
|
-
|
45
|
-
MyTableDefault.create_table().run_sync()
|
46
|
-
|
47
|
-
def tearDown(self):
|
48
|
-
MyTableDefault.alter().drop_table().run_sync()
|
38
|
+
class TestByteaDefault(TableTest):
|
39
|
+
tables = [MyTableDefault]
|
49
40
|
|
50
41
|
def test_json_default(self):
|
51
42
|
row = MyTableDefault()
|
@@ -1,18 +1,13 @@
|
|
1
1
|
import enum
|
2
|
-
from unittest import TestCase
|
3
2
|
|
4
3
|
from piccolo.columns.column_types import Array, Varchar
|
5
4
|
from piccolo.table import Table
|
6
|
-
from tests.base import engines_only
|
5
|
+
from tests.base import TableTest, engines_only
|
7
6
|
from tests.example_apps.music.tables import Shirt
|
8
7
|
|
9
8
|
|
10
|
-
class TestChoices(
|
11
|
-
|
12
|
-
Shirt.create_table().run_sync()
|
13
|
-
|
14
|
-
def tearDown(self):
|
15
|
-
Shirt.alter().drop_table().run_sync()
|
9
|
+
class TestChoices(TableTest):
|
10
|
+
tables = [Shirt]
|
16
11
|
|
17
12
|
def _insert_shirts(self):
|
18
13
|
Shirt.insert(
|
@@ -87,16 +82,12 @@ class Ticket(Table):
|
|
87
82
|
|
88
83
|
|
89
84
|
@engines_only("postgres", "sqlite")
|
90
|
-
class TestArrayChoices(
|
85
|
+
class TestArrayChoices(TableTest):
|
91
86
|
"""
|
92
87
|
🐛 Cockroach bug: https://github.com/cockroachdb/cockroach/issues/71908 "could not decorrelate subquery" error under asyncpg
|
93
88
|
""" # noqa: E501
|
94
89
|
|
95
|
-
|
96
|
-
Ticket.create_table().run_sync()
|
97
|
-
|
98
|
-
def tearDown(self):
|
99
|
-
Ticket.alter().drop_table().run_sync()
|
90
|
+
tables = [Ticket]
|
100
91
|
|
101
92
|
def test_string(self):
|
102
93
|
"""
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import datetime
|
2
|
-
from unittest import TestCase
|
3
2
|
|
4
3
|
from piccolo.columns.column_types import Date
|
5
4
|
from piccolo.columns.defaults.date import DateNow
|
6
5
|
from piccolo.table import Table
|
6
|
+
from tests.base import TableTest
|
7
7
|
|
8
8
|
|
9
9
|
class MyTable(Table):
|
@@ -14,12 +14,8 @@ class MyTableDefault(Table):
|
|
14
14
|
created_on = Date(default=DateNow())
|
15
15
|
|
16
16
|
|
17
|
-
class TestDate(
|
18
|
-
|
19
|
-
MyTable.create_table().run_sync()
|
20
|
-
|
21
|
-
def tearDown(self):
|
22
|
-
MyTable.alter().drop_table().run_sync()
|
17
|
+
class TestDate(TableTest):
|
18
|
+
tables = [MyTable]
|
23
19
|
|
24
20
|
def test_timestamp(self):
|
25
21
|
created_on = datetime.datetime.now().date()
|
@@ -31,12 +27,8 @@ class TestDate(TestCase):
|
|
31
27
|
self.assertEqual(result.created_on, created_on)
|
32
28
|
|
33
29
|
|
34
|
-
class TestDateDefault(
|
35
|
-
|
36
|
-
MyTableDefault.create_table().run_sync()
|
37
|
-
|
38
|
-
def tearDown(self):
|
39
|
-
MyTableDefault.alter().drop_table().run_sync()
|
30
|
+
class TestDateDefault(TableTest):
|
31
|
+
tables = [MyTableDefault]
|
40
32
|
|
41
33
|
def test_timestamp(self):
|
42
34
|
created_on = datetime.datetime.now().date()
|
@@ -1,19 +1,14 @@
|
|
1
|
-
from unittest import TestCase
|
2
|
-
|
3
1
|
from piccolo.columns.column_types import DoublePrecision
|
4
2
|
from piccolo.table import Table
|
3
|
+
from tests.base import TableTest
|
5
4
|
|
6
5
|
|
7
6
|
class MyTable(Table):
|
8
7
|
column_a = DoublePrecision()
|
9
8
|
|
10
9
|
|
11
|
-
class TestDoublePrecision(
|
12
|
-
|
13
|
-
MyTable.create_table().run_sync()
|
14
|
-
|
15
|
-
def tearDown(self):
|
16
|
-
MyTable.alter().drop_table().run_sync()
|
10
|
+
class TestDoublePrecision(TableTest):
|
11
|
+
tables = [MyTable]
|
17
12
|
|
18
13
|
def test_creation(self):
|
19
14
|
row = MyTable(column_a=1.23)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import datetime
|
2
|
-
from unittest import TestCase
|
3
2
|
|
4
3
|
from piccolo.columns.column_types import Interval
|
5
4
|
from piccolo.columns.defaults.interval import IntervalCustom
|
6
5
|
from piccolo.table import Table
|
6
|
+
from tests.base import TableTest
|
7
7
|
|
8
8
|
|
9
9
|
class MyTable(Table):
|
@@ -14,12 +14,8 @@ class MyTableDefault(Table):
|
|
14
14
|
interval = Interval(default=IntervalCustom(days=1))
|
15
15
|
|
16
16
|
|
17
|
-
class TestInterval(
|
18
|
-
|
19
|
-
MyTable.create_table().run_sync()
|
20
|
-
|
21
|
-
def tearDown(self):
|
22
|
-
MyTable.alter().drop_table().run_sync()
|
17
|
+
class TestInterval(TableTest):
|
18
|
+
tables = [MyTable]
|
23
19
|
|
24
20
|
def test_interval(self):
|
25
21
|
# Test a range of different timedeltas
|
@@ -91,12 +87,8 @@ class TestInterval(TestCase):
|
|
91
87
|
self.assertTrue(result)
|
92
88
|
|
93
89
|
|
94
|
-
class TestIntervalDefault(
|
95
|
-
|
96
|
-
MyTableDefault.create_table().run_sync()
|
97
|
-
|
98
|
-
def tearDown(self):
|
99
|
-
MyTableDefault.alter().drop_table().run_sync()
|
90
|
+
class TestIntervalDefault(TableTest):
|
91
|
+
tables = [MyTableDefault]
|
100
92
|
|
101
93
|
def test_interval(self):
|
102
94
|
row = MyTableDefault()
|