piccolo 0.108.0__tar.gz → 0.110.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-0.108.0 → piccolo-0.110.0}/PKG-INFO +2 -2
- {piccolo-0.108.0 → piccolo-0.110.0}/README.md +1 -1
- piccolo-0.110.0/piccolo/__init__.py +1 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/new.py +2 -3
- piccolo-0.108.0/piccolo/apps/asgi/commands/templates/app/_starlite_app.py.jinja → piccolo-0.110.0/piccolo/apps/asgi/commands/templates/app/_litestar_app.py.jinja +8 -8
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/app.py.jinja +2 -4
- piccolo-0.108.0/piccolo/apps/asgi/commands/templates/app/home/_starlite_endpoints.py.jinja → piccolo-0.110.0/piccolo/apps/asgi/commands/templates/app/home/_litestar_endpoints.py.jinja +2 -1
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/endpoints.py.jinja +2 -4
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/templates/home.html.jinja_raw +1 -6
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/playground/commands/run.py +24 -8
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/base.py +45 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/column_types.py +2 -2
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/select.py +25 -10
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/mixins.py +77 -3
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/testing/model_builder.py +9 -7
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo.egg-info/PKG-INFO +2 -2
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo.egg-info/SOURCES.txt +3 -4
- piccolo-0.110.0/tests/table/test_join_on.py +107 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_select.py +160 -1
- piccolo-0.108.0/piccolo/__init__.py +0 -1
- piccolo-0.108.0/piccolo/apps/asgi/commands/templates/app/_xpresso_app.py.jinja +0 -113
- piccolo-0.108.0/piccolo/apps/asgi/commands/templates/app/home/_xpresso_endpoints.py.jinja +0 -20
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/app/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/app/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/app/commands/new.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/app/commands/show_all.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/app/commands/templates/piccolo_app.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/app/commands/templates/tables.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/app/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/README.md.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/_blacksheep_app.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/_starlette_app.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/conftest.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/__init__.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/_blacksheep_endpoints.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/_starlette_endpoints.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_app.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_migrations/README.md +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/tables.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/templates/base.html.jinja_raw +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/main.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf_test.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/static/favicon.ico +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/static/main.css +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/fixtures/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/fixtures/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/fixtures/commands/dump.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/fixtures/commands/load.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/fixtures/commands/shared.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/fixtures/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/meta/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/meta/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/meta/commands/version.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/meta/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/auto/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/auto/diffable_table.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/auto/migration_manager.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/auto/operations.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/auto/schema_differ.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/auto/schema_snapshot.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/auto/serialisation.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/auto/serialisation_legacy.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/commands/backwards.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/commands/base.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/commands/check.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/commands/clean.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/commands/forwards.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/commands/new.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/commands/templates/migration.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/migrations/tables.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/playground/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/playground/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/playground/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/project/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/project/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/project/commands/new.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/project/commands/templates/piccolo_conf.py.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/project/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/schema/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/schema/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/schema/commands/exceptions.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/schema/commands/generate.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/schema/commands/graph.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/schema/commands/templates/graphviz.dot.jinja +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/schema/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/shell/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/shell/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/shell/commands/run.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/shell/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/sql_shell/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/sql_shell/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/sql_shell/commands/run.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/sql_shell/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/tester/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/tester/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/tester/commands/run.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/tester/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/commands/change_password.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/commands/change_permissions.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/commands/create.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/piccolo_migrations/2019-11-14T21-52-21.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/piccolo_migrations/2020-06-11T21-38-55.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/piccolo_migrations/2021-04-30T16-14-15.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/piccolo_migrations/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/user/tables.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/choices.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/combination.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/defaults/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/defaults/base.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/defaults/date.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/defaults/interval.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/defaults/time.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/defaults/timestamp.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/defaults/timestamptz.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/defaults/uuid.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/indexes.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/m2m.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/operators/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/operators/base.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/operators/comparison.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/operators/math.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/operators/string.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/readable.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/columns/reference.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/conf/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/conf/apps.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/custom_types.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/engine/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/engine/base.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/engine/cockroach.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/engine/exceptions.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/engine/finder.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/engine/postgres.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/engine/sqlite.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/main.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/py.typed +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/base.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/alter.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/count.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/create.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/create_index.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/delete.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/drop_index.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/exists.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/indexes.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/insert.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/objects.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/raw.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/refresh.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/table_exists.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/methods/update.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/query/proxy.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/querystring.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/table.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/table_reflection.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/testing/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/testing/random_builder.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/dictionary.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/encoding.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/graphlib/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/graphlib/_graphlib.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/lazy_loader.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/list.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/naming.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/objects.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/printing.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/pydantic.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/repr.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/sql_values.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/sync.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo/utils/warnings.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo.egg-info/dependency_links.txt +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo.egg-info/entry_points.txt +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo.egg-info/requires.txt +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/piccolo.egg-info/top_level.txt +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/profiling/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/profiling/run_profile.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/pyproject.toml +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/setup.cfg +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/setup.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/app/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/app/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/app/commands/test_new.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/app/commands/test_show_all.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/asgi/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/asgi/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/asgi/commands/test_new.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/fixtures/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/fixtures/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/fixtures/commands/test_dump_load.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/fixtures/commands/test_shared.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/meta/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/meta/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/meta/commands/test_version.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/auto/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/auto/integration/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/auto/integration/test_migrations.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/auto/test_diffable_table.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/auto/test_migration_manager.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/auto/test_schema_differ.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/auto/test_schema_snapshot.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/auto/test_serialisation.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/commands/test_base.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/commands/test_check.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/commands/test_clean.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/commands/test_forwards_backwards.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/commands/test_migrations/2020-03-31T20-38-22.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/commands/test_migrations/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/commands/test_new.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/migrations/test_migration.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/project/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/project/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/project/commands/test_new.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/schema/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/shell/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/shell/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/shell/commands/test_run.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/sql_shell/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/sql_shell/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/sql_shell/commands/test_run.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/tester/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/user/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/user/commands/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/user/commands/test_change_password.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/user/commands/test_change_permissions.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/user/commands/test_create.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/apps/user/test_tables.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_array.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_base.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_bigint.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_boolean.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_bytea.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_choices.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_combination.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_date.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_db_column_name.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_defaults.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_double_precision.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_interval.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_json.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_jsonb.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_m2m.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_numeric.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_primary_key.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_readable.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_real.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_reference.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_reserved_column_names.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_smallint.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_time.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_timestamp.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_timestamptz.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_uuid.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/columns/test_varchar.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/conf/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/conf/example.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/conf/test_apps.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/engine/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/engine/test_extra_nodes.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/engine/test_logging.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/engine/test_nested_transaction.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/engine/test_pool.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/engine/test_transaction.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/engine/test_version_parsing.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/mega/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/mega/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/mega/piccolo_migrations/2021-09-20T21-23-25-698988.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/mega/piccolo_migrations/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/mega/tables.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/music/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/music/piccolo_app.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/music/tables.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/example_apps/music/tables_detailed.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/mixins/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/mixins/test_columns_delegate.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/mixins/test_order_by_delegate.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/test_await.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/test_camelcase.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/test_freeze.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/test_gather.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/test_querystring.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/query/test_slots.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/instance/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/instance/test_create.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/instance/test_get_related.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/instance/test_get_related_readable.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/instance/test_instantiate.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/instance/test_remove.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/instance/test_save.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/instance/test_to_dict.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_all_columns.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_alter.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_batch.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_callback.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_constructor.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_count.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_create.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_create_db_tables.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_create_table_class.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_delete.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_drop_db_tables.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_exists.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_from_dict.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_indexes.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_inheritance.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_insert.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_join.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_metaclass.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_objects.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_output.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_raw.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_ref.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_refresh.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_repr.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_str.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_table_exists.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/table/test_update.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/testing/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/testing/test_model_builder.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/testing/test_random_builder.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/__init__.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_dictionary.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_encoding.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_lazy_loader.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_list.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_naming.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_printing.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_pydantic.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_sql_values.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_sync.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_table_reflection.py +0 -0
- {piccolo-0.108.0 → piccolo-0.110.0}/tests/utils/test_warnings.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: piccolo
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.110.0
|
4
4
|
Summary: A fast, user friendly ORM and query builder which supports asyncio.
|
5
5
|
Home-page: https://github.com/piccolo-orm/piccolo
|
6
6
|
Author: Daniel Townsend
|
@@ -105,7 +105,7 @@ Description: , [FastAPI](https://fastapi.tiangolo.com/), [BlackSheep](https://www.neoteroi.dev/blacksheep/)
|
108
|
+
[Starlette](https://www.starlette.io/), [FastAPI](https://fastapi.tiangolo.com/), [BlackSheep](https://www.neoteroi.dev/blacksheep/) and [Litestar](https://litestar.dev/) are currently supported.
|
109
109
|
|
110
110
|
## Are you a Django user?
|
111
111
|
|
@@ -94,7 +94,7 @@ Let Piccolo scaffold you an ASGI web app, using Piccolo as the ORM:
|
|
94
94
|
piccolo asgi new
|
95
95
|
```
|
96
96
|
|
97
|
-
[Starlette](https://www.starlette.io/), [FastAPI](https://fastapi.tiangolo.com/), [BlackSheep](https://www.neoteroi.dev/blacksheep/)
|
97
|
+
[Starlette](https://www.starlette.io/), [FastAPI](https://fastapi.tiangolo.com/), [BlackSheep](https://www.neoteroi.dev/blacksheep/) and [Litestar](https://litestar.dev/) are currently supported.
|
98
98
|
|
99
99
|
## Are you a Django user?
|
100
100
|
|
@@ -0,0 +1 @@
|
|
1
|
+
__VERSION__ = "0.110.0"
|
@@ -10,10 +10,9 @@ from jinja2 import Environment, FileSystemLoader
|
|
10
10
|
|
11
11
|
TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "templates/app/")
|
12
12
|
SERVERS = ["uvicorn", "Hypercorn"]
|
13
|
-
ROUTERS = ["starlette", "fastapi", "blacksheep", "
|
13
|
+
ROUTERS = ["starlette", "fastapi", "blacksheep", "litestar"]
|
14
14
|
ROUTER_DEPENDENCIES = {
|
15
|
-
"
|
16
|
-
"xpresso": ["xpresso==0.43.0", "di==0.72.1"],
|
15
|
+
"litestar": ["litestar>=2.0.0a3"],
|
17
16
|
}
|
18
17
|
|
19
18
|
|
@@ -2,13 +2,13 @@ import typing as t
|
|
2
2
|
|
3
3
|
from piccolo.engine import engine_finder
|
4
4
|
from piccolo_admin.endpoints import create_admin
|
5
|
-
from
|
6
|
-
from
|
7
|
-
from
|
8
|
-
from
|
9
|
-
from
|
10
|
-
from
|
11
|
-
from
|
5
|
+
from litestar import Litestar, asgi, delete, get, patch, post
|
6
|
+
from litestar.static_files import StaticFilesConfig
|
7
|
+
from litestar.template import TemplateConfig
|
8
|
+
from litestar.contrib.jinja import JinjaTemplateEngine
|
9
|
+
from litestar.contrib.piccolo_orm import PiccoloORMPlugin
|
10
|
+
from litestar.exceptions import NotFoundException
|
11
|
+
from litestar.types import Receive, Scope, Send
|
12
12
|
|
13
13
|
from home.endpoints import home
|
14
14
|
from home.piccolo_app import APP_CONFIG
|
@@ -71,7 +71,7 @@ async def close_database_connection_pool():
|
|
71
71
|
print("Unable to connect to the database")
|
72
72
|
|
73
73
|
|
74
|
-
app =
|
74
|
+
app = Litestar(
|
75
75
|
route_handlers=[
|
76
76
|
admin,
|
77
77
|
home,
|
@@ -4,8 +4,6 @@
|
|
4
4
|
{% include '_starlette_app.py.jinja' %}
|
5
5
|
{% elif router == 'blacksheep' %}
|
6
6
|
{% include '_blacksheep_app.py.jinja' %}
|
7
|
-
{% elif router == '
|
8
|
-
{% include '
|
9
|
-
{% elif router == 'starlite' %}
|
10
|
-
{% include '_starlite_app.py.jinja' %}
|
7
|
+
{% elif router == 'litestar' %}
|
8
|
+
{% include '_litestar_app.py.jinja' %}
|
11
9
|
{% endif %}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import os
|
2
2
|
|
3
3
|
import jinja2
|
4
|
-
from
|
4
|
+
from litestar import MediaType, Request, Response, get
|
5
5
|
|
6
6
|
ENVIRONMENT = jinja2.Environment(
|
7
7
|
loader=jinja2.FileSystemLoader(
|
@@ -19,3 +19,4 @@ def home(request: Request) -> Response:
|
|
19
19
|
media_type=MediaType.HTML,
|
20
20
|
status_code=200,
|
21
21
|
)
|
22
|
+
|
{piccolo-0.108.0 → piccolo-0.110.0}/piccolo/apps/asgi/commands/templates/app/home/endpoints.py.jinja
RENAMED
@@ -2,8 +2,6 @@
|
|
2
2
|
{% include '_starlette_endpoints.py.jinja' %}
|
3
3
|
{% elif router == 'blacksheep' %}
|
4
4
|
{% include '_blacksheep_endpoints.py.jinja' %}
|
5
|
-
{% elif router == '
|
6
|
-
{% include '
|
7
|
-
{% elif router == 'starlite' %}
|
8
|
-
{% include '_starlite_endpoints.py.jinja' %}
|
5
|
+
{% elif router == 'litestar' %}
|
6
|
+
{% include '_litestar_endpoints.py.jinja' %}
|
9
7
|
{% endif %}
|
@@ -51,12 +51,7 @@
|
|
51
51
|
<li><a href="/admin/">Admin</a></li>
|
52
52
|
<li><a href="/docs/">Swagger API</a></li>
|
53
53
|
</ul>
|
54
|
-
<h3>
|
55
|
-
<ul>
|
56
|
-
<li><a href="/admin/">Admin</a></li>
|
57
|
-
<li><a href="/docs/">Swagger API</a></li>
|
58
|
-
</ul>
|
59
|
-
<h3>Starlite</h3>
|
54
|
+
<h3>Litestar</h3>
|
60
55
|
<ul>
|
61
56
|
<li><a href="/admin/">Admin</a></li>
|
62
57
|
<li><a href="/schema/swagger">Swagger API</a></li>
|
@@ -136,8 +136,7 @@ def populate():
|
|
136
136
|
"""
|
137
137
|
for _table in reversed(TABLES):
|
138
138
|
try:
|
139
|
-
|
140
|
-
_table.alter().drop_table().run_sync()
|
139
|
+
_table.alter().drop_table(if_exists=True).run_sync()
|
141
140
|
except Exception as e:
|
142
141
|
print(e)
|
143
142
|
|
@@ -180,13 +179,30 @@ def populate():
|
|
180
179
|
ticket = Ticket(concert=concert.id, price=Decimal("50.0"))
|
181
180
|
ticket.save().run_sync()
|
182
181
|
|
183
|
-
|
184
|
-
|
182
|
+
DiscountCode.insert(
|
183
|
+
*[DiscountCode({DiscountCode.code: uuid.uuid4()}) for _ in range(5)]
|
184
|
+
).run_sync()
|
185
185
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
186
|
+
RecordingStudio.insert(
|
187
|
+
RecordingStudio(
|
188
|
+
{
|
189
|
+
RecordingStudio.name: "Abbey Road",
|
190
|
+
RecordingStudio.facilities: {
|
191
|
+
"restaurant": True,
|
192
|
+
"mixing_desk": True,
|
193
|
+
},
|
194
|
+
}
|
195
|
+
),
|
196
|
+
RecordingStudio(
|
197
|
+
{
|
198
|
+
RecordingStudio.name: "Electric Lady",
|
199
|
+
RecordingStudio.facilities: {
|
200
|
+
"restaurant": False,
|
201
|
+
"mixing_desk": True,
|
202
|
+
},
|
203
|
+
},
|
204
|
+
),
|
205
|
+
).run_sync()
|
190
206
|
|
191
207
|
|
192
208
|
def run(
|
@@ -759,6 +759,51 @@ class Column(Selectable):
|
|
759
759
|
column._alias = name
|
760
760
|
return column
|
761
761
|
|
762
|
+
def join_on(self, column: Column) -> ForeignKey:
|
763
|
+
"""
|
764
|
+
Joins are typically performed via foreign key columns. For example,
|
765
|
+
here we get the band's name and the manager's name::
|
766
|
+
|
767
|
+
class Manager(Table):
|
768
|
+
name = Varchar()
|
769
|
+
|
770
|
+
class Band(Table):
|
771
|
+
name = Varchar()
|
772
|
+
manager = ForeignKey(Manager)
|
773
|
+
|
774
|
+
>>> await Band.select(Band.name, Band.manager.name)
|
775
|
+
|
776
|
+
The ``join_on`` method lets you join tables even when foreign keys
|
777
|
+
don't exist, by joining on a column in another table.
|
778
|
+
|
779
|
+
For example, here we want to get the manager's email, but no foreign
|
780
|
+
key exists::
|
781
|
+
|
782
|
+
class Manager(Table):
|
783
|
+
name = Varchar(unique=True)
|
784
|
+
email = Varchar()
|
785
|
+
|
786
|
+
class Band(Table):
|
787
|
+
name = Varchar()
|
788
|
+
manager_name = Varchar()
|
789
|
+
|
790
|
+
>>> await Band.select(
|
791
|
+
... Band.name,
|
792
|
+
... Band.manager_name.join_on(Manager.name).email
|
793
|
+
... )
|
794
|
+
|
795
|
+
"""
|
796
|
+
from piccolo.columns.column_types import ForeignKey
|
797
|
+
|
798
|
+
virtual_foreign_key = ForeignKey(
|
799
|
+
references=column._meta.table, target_column=column
|
800
|
+
)
|
801
|
+
virtual_foreign_key._meta._name = self._meta.name
|
802
|
+
virtual_foreign_key._meta.call_chain = [*self._meta.call_chain]
|
803
|
+
virtual_foreign_key._meta._table = self._meta.table
|
804
|
+
virtual_foreign_key.set_proxy_columns()
|
805
|
+
return virtual_foreign_key
|
806
|
+
|
762
807
|
def get_default_value(self) -> t.Any:
|
763
808
|
"""
|
764
809
|
If the column has a default attribute, return it. If it's callable,
|
@@ -1784,7 +1784,7 @@ class ForeignKey(Column):
|
|
1784
1784
|
|
1785
1785
|
:param on_update:
|
1786
1786
|
Determines what the database should do when a row has it's primary key
|
1787
|
-
updated. If set to ``
|
1787
|
+
updated. If set to ``OnUpdate.cascade``, any rows referencing the
|
1788
1788
|
updated row will have their references updated to point to the new
|
1789
1789
|
primary key.
|
1790
1790
|
|
@@ -1800,7 +1800,7 @@ class ForeignKey(Column):
|
|
1800
1800
|
|
1801
1801
|
.. code-block:: python
|
1802
1802
|
|
1803
|
-
from piccolo.columns import
|
1803
|
+
from piccolo.columns import OnUpdate
|
1804
1804
|
|
1805
1805
|
class Band(Table):
|
1806
1806
|
name = ForeignKey(
|
@@ -353,8 +353,18 @@ class Select(Query[TableInstance, t.List[t.Dict[str, t.Any]]]):
|
|
353
353
|
self.columns_delegate.columns(*_columns)
|
354
354
|
return self
|
355
355
|
|
356
|
-
def distinct(
|
357
|
-
self.
|
356
|
+
def distinct(
|
357
|
+
self: Self, *, on: t.Optional[t.Sequence[Column]] = None
|
358
|
+
) -> Self:
|
359
|
+
if on is not None and self.engine_type not in (
|
360
|
+
"postgres",
|
361
|
+
"cockroach",
|
362
|
+
):
|
363
|
+
raise ValueError(
|
364
|
+
"Only Postgres and Cockroach supports DISTINCT ON"
|
365
|
+
)
|
366
|
+
|
367
|
+
self.distinct_delegate.distinct(enabled=True, on=on)
|
358
368
|
return self
|
359
369
|
|
360
370
|
def group_by(self: Self, *columns: t.Union[Column, str]) -> Self:
|
@@ -722,17 +732,22 @@ class Select(Query[TableInstance, t.List[t.Dict[str, t.Any]]]):
|
|
722
732
|
|
723
733
|
#######################################################################
|
724
734
|
|
725
|
-
|
726
|
-
"SELECT DISTINCT" if self.distinct_delegate._distinct else "SELECT"
|
727
|
-
)
|
728
|
-
query = f"{select} {columns_str} FROM {self.table._meta.tablename}"
|
735
|
+
args: t.List[t.Any] = []
|
729
736
|
|
730
|
-
|
731
|
-
query += f" {join}"
|
737
|
+
query = "SELECT"
|
732
738
|
|
733
|
-
|
739
|
+
distinct = self.distinct_delegate._distinct
|
740
|
+
if distinct:
|
741
|
+
if distinct.on:
|
742
|
+
distinct.validate_on(self.order_by_delegate._order_by)
|
734
743
|
|
735
|
-
|
744
|
+
query += "{}"
|
745
|
+
args.append(distinct.querystring)
|
746
|
+
|
747
|
+
query += f" {columns_str} FROM {self.table._meta.tablename}"
|
748
|
+
|
749
|
+
for join in joins:
|
750
|
+
query += f" {join}"
|
736
751
|
|
737
752
|
if self.as_of_delegate._as_of:
|
738
753
|
query += "{}"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import asyncio
|
4
|
+
import collections.abc
|
4
5
|
import itertools
|
5
6
|
import typing as t
|
6
7
|
from dataclasses import dataclass, field
|
@@ -18,6 +19,70 @@ if t.TYPE_CHECKING: # pragma: no cover
|
|
18
19
|
from piccolo.table import Table # noqa
|
19
20
|
|
20
21
|
|
22
|
+
class DistinctOnError(ValueError):
|
23
|
+
"""
|
24
|
+
Raised when ``DISTINCT ON`` queries are malformed.
|
25
|
+
"""
|
26
|
+
|
27
|
+
pass
|
28
|
+
|
29
|
+
|
30
|
+
@dataclass
|
31
|
+
class Distinct:
|
32
|
+
__slots__ = ("enabled", "on")
|
33
|
+
|
34
|
+
enabled: bool
|
35
|
+
on: t.Optional[t.Sequence[Column]]
|
36
|
+
|
37
|
+
@property
|
38
|
+
def querystring(self) -> QueryString:
|
39
|
+
if self.enabled:
|
40
|
+
if self.on:
|
41
|
+
column_names = ", ".join(
|
42
|
+
i._meta.get_full_name(with_alias=False) for i in self.on
|
43
|
+
)
|
44
|
+
return QueryString(f" DISTINCT ON ({column_names})")
|
45
|
+
else:
|
46
|
+
return QueryString(" DISTINCT")
|
47
|
+
else:
|
48
|
+
return QueryString(" ALL")
|
49
|
+
|
50
|
+
def validate_on(self, order_by: OrderBy):
|
51
|
+
"""
|
52
|
+
When using the `on` argument, the first column must match the first
|
53
|
+
order by column.
|
54
|
+
|
55
|
+
:raises DistinctOnError:
|
56
|
+
If the columns don't match.
|
57
|
+
|
58
|
+
"""
|
59
|
+
validated = True
|
60
|
+
|
61
|
+
try:
|
62
|
+
first_order_column = order_by.order_by_items[0].columns[0]
|
63
|
+
except IndexError:
|
64
|
+
validated = False
|
65
|
+
else:
|
66
|
+
if not self.on:
|
67
|
+
validated = False
|
68
|
+
elif isinstance(first_order_column, Column) and not self.on[
|
69
|
+
0
|
70
|
+
]._equals(first_order_column):
|
71
|
+
validated = False
|
72
|
+
|
73
|
+
if not validated:
|
74
|
+
raise DistinctOnError(
|
75
|
+
"The first `order_by` column must match the first column "
|
76
|
+
"passed to `on`."
|
77
|
+
)
|
78
|
+
|
79
|
+
def __str__(self) -> str:
|
80
|
+
return self.querystring.__str__()
|
81
|
+
|
82
|
+
def copy(self) -> Distinct:
|
83
|
+
return self.__class__(enabled=self.enabled, on=self.on)
|
84
|
+
|
85
|
+
|
21
86
|
@dataclass
|
22
87
|
class Limit:
|
23
88
|
__slots__ = ("number",)
|
@@ -259,10 +324,19 @@ class AsOfDelegate:
|
|
259
324
|
@dataclass
|
260
325
|
class DistinctDelegate:
|
261
326
|
|
262
|
-
_distinct:
|
327
|
+
_distinct: Distinct = field(
|
328
|
+
default_factory=lambda: Distinct(enabled=False, on=None)
|
329
|
+
)
|
330
|
+
|
331
|
+
def distinct(
|
332
|
+
self, enabled: bool, on: t.Optional[t.Sequence[Column]] = None
|
333
|
+
):
|
334
|
+
if on and not isinstance(on, collections.abc.Sequence):
|
335
|
+
# Check a sequence is passed in, otherwise the user will get some
|
336
|
+
# unuseful errors later on.
|
337
|
+
raise ValueError("`on` must be a sequence of `Column` instances")
|
263
338
|
|
264
|
-
|
265
|
-
self._distinct = True
|
339
|
+
self._distinct = Distinct(enabled=enabled, on=on)
|
266
340
|
|
267
341
|
|
268
342
|
@dataclass
|
@@ -1,3 +1,5 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import json
|
2
4
|
import typing as t
|
3
5
|
from datetime import date, datetime, time, timedelta
|
@@ -5,7 +7,7 @@ from decimal import Decimal
|
|
5
7
|
from uuid import UUID
|
6
8
|
|
7
9
|
from piccolo.columns import Array, Column
|
8
|
-
from piccolo.
|
10
|
+
from piccolo.custom_types import TableInstance
|
9
11
|
from piccolo.testing.random_builder import RandomBuilder
|
10
12
|
from piccolo.utils.sync import run_sync
|
11
13
|
|
@@ -27,11 +29,11 @@ class ModelBuilder:
|
|
27
29
|
@classmethod
|
28
30
|
async def build(
|
29
31
|
cls,
|
30
|
-
table_class: t.Type[
|
32
|
+
table_class: t.Type[TableInstance],
|
31
33
|
defaults: t.Dict[t.Union[Column, str], t.Any] = None,
|
32
34
|
persist: bool = True,
|
33
35
|
minimal: bool = False,
|
34
|
-
) ->
|
36
|
+
) -> TableInstance:
|
35
37
|
"""
|
36
38
|
Build a ``Table`` instance with random data and save async.
|
37
39
|
If the ``Table`` has any foreign keys, then the related rows are also
|
@@ -78,11 +80,11 @@ class ModelBuilder:
|
|
78
80
|
@classmethod
|
79
81
|
def build_sync(
|
80
82
|
cls,
|
81
|
-
table_class: t.Type[
|
83
|
+
table_class: t.Type[TableInstance],
|
82
84
|
defaults: t.Dict[t.Union[Column, str], t.Any] = None,
|
83
85
|
persist: bool = True,
|
84
86
|
minimal: bool = False,
|
85
|
-
) ->
|
87
|
+
) -> TableInstance:
|
86
88
|
"""
|
87
89
|
A sync wrapper around :meth:`build`.
|
88
90
|
"""
|
@@ -98,11 +100,11 @@ class ModelBuilder:
|
|
98
100
|
@classmethod
|
99
101
|
async def _build(
|
100
102
|
cls,
|
101
|
-
table_class: t.Type[
|
103
|
+
table_class: t.Type[TableInstance],
|
102
104
|
defaults: t.Dict[t.Union[Column, str], t.Any] = None,
|
103
105
|
minimal: bool = False,
|
104
106
|
persist: bool = True,
|
105
|
-
) ->
|
107
|
+
) -> TableInstance:
|
106
108
|
model = table_class(_ignore_missing=True)
|
107
109
|
defaults = {} if not defaults else defaults
|
108
110
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: piccolo
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.110.0
|
4
4
|
Summary: A fast, user friendly ORM and query builder which supports asyncio.
|
5
5
|
Home-page: https://github.com/piccolo-orm/piccolo
|
6
6
|
Author: Daniel Townsend
|
@@ -105,7 +105,7 @@ Description: , [FastAPI](https://fastapi.tiangolo.com/), [BlackSheep](https://www.neoteroi.dev/blacksheep/)
|
108
|
+
[Starlette](https://www.starlette.io/), [FastAPI](https://fastapi.tiangolo.com/), [BlackSheep](https://www.neoteroi.dev/blacksheep/) and [Litestar](https://litestar.dev/) are currently supported.
|
109
109
|
|
110
110
|
## Are you a Django user?
|
111
111
|
|
@@ -29,9 +29,8 @@ piccolo/apps/asgi/commands/new.py
|
|
29
29
|
piccolo/apps/asgi/commands/templates/app/README.md.jinja
|
30
30
|
piccolo/apps/asgi/commands/templates/app/_blacksheep_app.py.jinja
|
31
31
|
piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja
|
32
|
+
piccolo/apps/asgi/commands/templates/app/_litestar_app.py.jinja
|
32
33
|
piccolo/apps/asgi/commands/templates/app/_starlette_app.py.jinja
|
33
|
-
piccolo/apps/asgi/commands/templates/app/_starlite_app.py.jinja
|
34
|
-
piccolo/apps/asgi/commands/templates/app/_xpresso_app.py.jinja
|
35
34
|
piccolo/apps/asgi/commands/templates/app/app.py.jinja
|
36
35
|
piccolo/apps/asgi/commands/templates/app/conftest.py.jinja
|
37
36
|
piccolo/apps/asgi/commands/templates/app/main.py.jinja
|
@@ -40,9 +39,8 @@ piccolo/apps/asgi/commands/templates/app/piccolo_conf_test.py.jinja
|
|
40
39
|
piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja
|
41
40
|
piccolo/apps/asgi/commands/templates/app/home/__init__.py.jinja
|
42
41
|
piccolo/apps/asgi/commands/templates/app/home/_blacksheep_endpoints.py.jinja
|
42
|
+
piccolo/apps/asgi/commands/templates/app/home/_litestar_endpoints.py.jinja
|
43
43
|
piccolo/apps/asgi/commands/templates/app/home/_starlette_endpoints.py.jinja
|
44
|
-
piccolo/apps/asgi/commands/templates/app/home/_starlite_endpoints.py.jinja
|
45
|
-
piccolo/apps/asgi/commands/templates/app/home/_xpresso_endpoints.py.jinja
|
46
44
|
piccolo/apps/asgi/commands/templates/app/home/endpoints.py.jinja
|
47
45
|
piccolo/apps/asgi/commands/templates/app/home/piccolo_app.py.jinja
|
48
46
|
piccolo/apps/asgi/commands/templates/app/home/tables.py.jinja
|
@@ -316,6 +314,7 @@ tests/table/test_indexes.py
|
|
316
314
|
tests/table/test_inheritance.py
|
317
315
|
tests/table/test_insert.py
|
318
316
|
tests/table/test_join.py
|
317
|
+
tests/table/test_join_on.py
|
319
318
|
tests/table/test_metaclass.py
|
320
319
|
tests/table/test_objects.py
|
321
320
|
tests/table/test_output.py
|
@@ -0,0 +1,107 @@
|
|
1
|
+
from unittest import TestCase
|
2
|
+
|
3
|
+
from piccolo.columns import Varchar
|
4
|
+
from piccolo.table import Table
|
5
|
+
|
6
|
+
|
7
|
+
class Manager(Table):
|
8
|
+
name = Varchar(unique=True)
|
9
|
+
email = Varchar(unique=True)
|
10
|
+
|
11
|
+
|
12
|
+
class Band(Table):
|
13
|
+
name = Varchar(unique=True)
|
14
|
+
manager_name = Varchar()
|
15
|
+
|
16
|
+
|
17
|
+
class Concert(Table):
|
18
|
+
title = Varchar()
|
19
|
+
band_name = Varchar()
|
20
|
+
|
21
|
+
|
22
|
+
class TestJoinOn(TestCase):
|
23
|
+
|
24
|
+
tables = [Manager, Band, Concert]
|
25
|
+
|
26
|
+
def setUp(self):
|
27
|
+
for table in self.tables:
|
28
|
+
table.create_table().run_sync()
|
29
|
+
|
30
|
+
Manager.insert(
|
31
|
+
Manager(name="Guido", email="guido@example.com"),
|
32
|
+
Manager(name="Maz", email="maz@example.com"),
|
33
|
+
Manager(name="Graydon", email="graydon@example.com"),
|
34
|
+
).run_sync()
|
35
|
+
|
36
|
+
Band.insert(
|
37
|
+
Band(name="Pythonistas", manager_name="Guido"),
|
38
|
+
Band(name="Rustaceans", manager_name="Graydon"),
|
39
|
+
).run_sync()
|
40
|
+
|
41
|
+
Concert.insert(
|
42
|
+
Concert(
|
43
|
+
title="Rockfest",
|
44
|
+
band_name="Pythonistas",
|
45
|
+
),
|
46
|
+
).run_sync()
|
47
|
+
|
48
|
+
def tearDown(self):
|
49
|
+
for table in self.tables:
|
50
|
+
table.alter().drop_table().run_sync()
|
51
|
+
|
52
|
+
def test_join_on(self):
|
53
|
+
"""
|
54
|
+
Do a simple join between two tables.
|
55
|
+
"""
|
56
|
+
query = Band.select(
|
57
|
+
Band.name,
|
58
|
+
Band.manager_name,
|
59
|
+
Band.manager_name.join_on(Manager.name).email.as_alias(
|
60
|
+
"manager_email"
|
61
|
+
),
|
62
|
+
).order_by(Band.id)
|
63
|
+
|
64
|
+
response = query.run_sync()
|
65
|
+
|
66
|
+
self.assertListEqual(
|
67
|
+
response,
|
68
|
+
[
|
69
|
+
{
|
70
|
+
"name": "Pythonistas",
|
71
|
+
"manager_name": "Guido",
|
72
|
+
"manager_email": "guido@example.com",
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"name": "Rustaceans",
|
76
|
+
"manager_name": "Graydon",
|
77
|
+
"manager_email": "graydon@example.com",
|
78
|
+
},
|
79
|
+
],
|
80
|
+
)
|
81
|
+
|
82
|
+
def test_deeper_join(self):
|
83
|
+
"""
|
84
|
+
Do a join between three tables.
|
85
|
+
"""
|
86
|
+
response = (
|
87
|
+
Concert.select(
|
88
|
+
Concert.title,
|
89
|
+
Concert.band_name,
|
90
|
+
Concert.band_name.join_on(Band.name)
|
91
|
+
.manager_name.join_on(Manager.name)
|
92
|
+
.email.as_alias("manager_email"),
|
93
|
+
)
|
94
|
+
.order_by(Concert.id)
|
95
|
+
.run_sync()
|
96
|
+
)
|
97
|
+
|
98
|
+
self.assertListEqual(
|
99
|
+
response,
|
100
|
+
[
|
101
|
+
{
|
102
|
+
"title": "Rockfest",
|
103
|
+
"band_name": "Pythonistas",
|
104
|
+
"manager_email": "guido@example.com",
|
105
|
+
}
|
106
|
+
],
|
107
|
+
)
|