Showing preview only (3,118K chars total). Download the full file or copy to clipboard to get everything.
Repository: LuisLuii/FastAPIQuickCRUD
Branch: main
Commit: 2f959d815ad6
Files: 212
Total size: 2.9 MB
Directory structure:
gitextract_k7u649z0/
├── .coveragerc
├── .github/
│ └── workflows/
│ ├── ci.yml
│ ├── coverage.yml
│ └── release.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── README_zh.md
├── __init__.py
├── __main__.py
├── setup.py
├── src/
│ ├── __init__.py
│ └── fastapi_quickcrud/
│ ├── __init__.py
│ ├── crud_router.py
│ └── misc/
│ ├── __init__.py
│ ├── abstract_execute.py
│ ├── abstract_parser.py
│ ├── abstract_query.py
│ ├── abstract_route.py
│ ├── covert_model.py
│ ├── crud_model.py
│ ├── exceptions.py
│ ├── memory_sql.py
│ ├── schema_builder.py
│ ├── type.py
│ └── utils.py
├── tests/
│ ├── __init__.py
│ ├── conf/
│ │ ├── __init__.py
│ │ ├── config.py
│ │ ├── dev.docker-compose.yml
│ │ └── dev.env
│ └── test_implementations/
│ ├── __init__.py
│ ├── other/
│ │ └── __init__.py
│ ├── test_memory_sqlalchemy/
│ │ ├── __init__.py
│ │ ├── api_async_test/
│ │ │ ├── __init__.py
│ │ │ ├── foreign_tree/
│ │ │ │ ├── __init__.py
│ │ │ │ └── test_relationship_m2m.py
│ │ │ ├── test_create_many_api.py
│ │ │ ├── test_create_one_api.py
│ │ │ ├── test_delete_many_api.py
│ │ │ ├── test_delete_one_api.py
│ │ │ ├── test_get_many_api.py
│ │ │ ├── test_get_one_api.py
│ │ │ ├── test_other_default_value.py
│ │ │ ├── test_other_set_description.py
│ │ │ ├── test_other_single_unique.py
│ │ │ ├── test_patch_many_api.py
│ │ │ ├── test_patch_one_api.py
│ │ │ ├── test_post_redirect_get_api.py
│ │ │ ├── test_put_many_api.py
│ │ │ └── test_put_one_api.py
│ │ ├── api_test/
│ │ │ ├── __init__.py
│ │ │ ├── foreign_tree/
│ │ │ │ ├── __init__.py
│ │ │ │ └── test_relationship_m2m.py
│ │ │ ├── join_relationship/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── test_relationship_extra.py
│ │ │ │ ├── test_relationship_m2m.py
│ │ │ │ ├── test_relationship_m2m_back_populates.py
│ │ │ │ ├── test_relationship_m2o.py
│ │ │ │ ├── test_relationship_m2o_back_populates.py
│ │ │ │ ├── test_relationship_m2o_back_refer.py
│ │ │ │ ├── test_relationship_o2m.py
│ │ │ │ ├── test_relationship_o2m_back_populates.py
│ │ │ │ ├── test_relationship_o2m_back_ref.py
│ │ │ │ └── test_relationship_o2o.py
│ │ │ ├── test_create_many_api.py
│ │ │ ├── test_create_one_api.py
│ │ │ ├── test_delete_many_api.py
│ │ │ ├── test_delete_one_api.py
│ │ │ ├── test_get_many_api.py
│ │ │ ├── test_get_one_api.py
│ │ │ ├── test_other_default_value.py
│ │ │ ├── test_other_set_description.py
│ │ │ ├── test_other_single_unique.py
│ │ │ ├── test_patch_many_api.py
│ │ │ ├── test_patch_one_api.py
│ │ │ ├── test_post_redirect_get_api.py
│ │ │ ├── test_put_many_api.py
│ │ │ └── test_put_one_api.py
│ │ └── error_test/
│ │ ├── __init__.py
│ │ ├── test_create_null_type.py
│ │ ├── test_create_specific_api_when_no_pk.py
│ │ ├── test_create_table_with_more_than_one_unique_but_no_use_composite.py
│ │ ├── test_use_blob_type_column.py
│ │ ├── test_use_composite_primary.py
│ │ ├── test_use_more_than_one_pk.py
│ │ ├── test_use_more_than_one_unique.py
│ │ ├── test_use_unique_and_composite_unique.py
│ │ ├── test_use_unsupported_type_pk.py
│ │ ├── test_use_unsupported_type_pk_2.py
│ │ ├── test_use_unsupported_type_pk_3.py
│ │ └── test_use_unsupported_type_pk_4.py
│ ├── test_sqlalchemy/
│ │ ├── __init__.py
│ │ ├── api_test/
│ │ │ ├── __init__.py
│ │ │ ├── join_relationship/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── test_relationship_m2m.py
│ │ │ │ ├── test_relationship_m2m_back_populates.py
│ │ │ │ ├── test_relationship_m2o.py
│ │ │ │ ├── test_relationship_m2o_back_populates.py
│ │ │ │ ├── test_relationship_m2o_back_refer.py
│ │ │ │ ├── test_relationship_o2m.py
│ │ │ │ ├── test_relationship_o2m_back_populates.py
│ │ │ │ ├── test_relationship_o2m_back_ref.py
│ │ │ │ └── test_relationship_o2o.py
│ │ │ ├── test_create_many_api.py
│ │ │ ├── test_create_one_api.py
│ │ │ ├── test_delete_many_api.py
│ │ │ ├── test_delete_one_api.py
│ │ │ ├── test_get_many_api.py
│ │ │ ├── test_get_one_api.py
│ │ │ ├── test_other_default_value.py
│ │ │ ├── test_other_set_description.py
│ │ │ ├── test_other_single_unique.py
│ │ │ ├── test_other_uuid_primary.py
│ │ │ ├── test_patch_many_api.py
│ │ │ ├── test_patch_one_api.py
│ │ │ ├── test_post_redirect_get_api.py
│ │ │ ├── test_put_many_api.py
│ │ │ └── test_put_one_api.py
│ │ ├── api_test_async/
│ │ │ ├── __init__.py
│ │ │ ├── test_create_many_api.py
│ │ │ ├── test_create_one_api.py
│ │ │ ├── test_delete_many_api.py
│ │ │ ├── test_delete_one_api.py
│ │ │ ├── test_get_many_api.py
│ │ │ ├── test_get_one_api.py
│ │ │ ├── test_other_default_value.py
│ │ │ ├── test_other_single_unique.py
│ │ │ ├── test_other_uuid_primary.py
│ │ │ ├── test_patch_many_api.py
│ │ │ ├── test_patch_one_api.py
│ │ │ ├── test_post_redirect_get_api.py
│ │ │ ├── test_put_many_api.py
│ │ │ └── test_put_one_api.py
│ │ └── error_test/
│ │ ├── __init__.py
│ │ ├── test_create_null_type.py
│ │ ├── test_create_specific_api_when_no_pk.py
│ │ ├── test_create_table_with_more_than_one_unique_but_no_use_composite.py
│ │ ├── test_use_blob_type_column.py
│ │ ├── test_use_composite_primary.py
│ │ ├── test_use_more_than_one_pk.py
│ │ ├── test_use_more_than_one_unique.py
│ │ ├── test_use_unique_and_composite_unique.py
│ │ ├── test_use_unsupported_type_pk.py
│ │ ├── test_use_unsupported_type_pk_2.py
│ │ ├── test_use_unsupported_type_pk_3.py
│ │ └── test_use_unsupported_type_pk_4.py
│ └── test_sqlalchemy_table/
│ ├── __init__.py
│ ├── api_test/
│ │ ├── __init__.py
│ │ ├── test_delete_many_api.py
│ │ ├── test_delete_one_api.py
│ │ ├── test_get_many_api.py
│ │ ├── test_get_one_api.py
│ │ ├── test_other_no_alias.py
│ │ ├── test_other_set_description.py
│ │ ├── test_other_single_unique.py
│ │ ├── test_other_user_default_value.py
│ │ ├── test_other_uuid_primary.py
│ │ ├── test_patch_many_api.py
│ │ ├── test_patch_one_api.py
│ │ ├── test_post_redirect_get_api.py
│ │ ├── test_put_many_api.py
│ │ ├── test_put_one_api.py
│ │ ├── test_upsert_many_api.py
│ │ └── test_upsert_one_api.py
│ ├── api_test_async/
│ │ ├── __init__.py
│ │ ├── test_create_many_api.py
│ │ ├── test_create_one_api.py
│ │ ├── test_delete_many_api.py
│ │ ├── test_delete_one_api.py
│ │ ├── test_get_many_api.py
│ │ ├── test_get_one_api.py
│ │ ├── test_other_default_value.py
│ │ ├── test_other_no_alias.py
│ │ ├── test_other_single_unique.py
│ │ ├── test_other_uuid_primary.py
│ │ ├── test_patch_many_api.py
│ │ ├── test_patch_one_api.py
│ │ ├── test_post_redirect_get_api.py
│ │ ├── test_put_many_api.py
│ │ └── test_put_one_api.py
│ └── error_test/
│ ├── __init__.py
│ ├── test_create_null_type.py
│ ├── test_pk_no_default_value.py
│ ├── test_use_composite_primary.py
│ ├── test_use_more_than_one_pk.py
│ ├── test_use_more_than_one_unique.py
│ ├── test_use_unique_and_composite_unique.py
│ ├── test_use_unsupported_type.py
│ ├── test_use_unsupported_type_2.py
│ ├── test_use_unsupported_type_3.py
│ └── test_use_unsupported_type_4.py
└── tutorial/
├── __init__.py
├── basic_usage/
│ ├── __init__.py
│ ├── depencies_example_auth.py
│ ├── quick_usage_with_async_SQLALchemy_Base.py
│ ├── quick_usage_with_async_SQLALchemy_table.py
│ ├── quick_usage_with_async_SQLALchemy_table_with_out_primary_key.py
│ └── quick_usage_with_sync_SQLAlchemy_Base.py
├── foreign_tree/
│ ├── __init__.py
│ ├── async_m2m.py
│ ├── m2m.py
│ └── sample_tree.py
├── relationship/
│ ├── __init__.py
│ ├── many_to_many.py
│ ├── many_to_one.py
│ ├── one_to_many.py
│ └── one_to_one.py
├── sample.py
├── sample_case.py
└── sample_two_table.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .coveragerc
================================================
[report]
show_missing = True
omit =
/usr/*
venv/*
tests/*
src/fastapi_quickcrud/misc/abstract_execute.py
src/fastapi_quickcrud/misc/abstract_query.py
# Regexes for lines to exclude from consideration
exclude_lines =
raise NotImplementedError
self._exclude_column = \[\]
if __name__ == .__main__.:
pass
session.expire_all()
return async_execute_and_expire_result
if 'duplicate key value violates unique constraint' not in err_msg:
raise UnknownError(f'Unknown error, {i}')
response_result = await parsing_service.async_find_one
return response_result
parsed_response = await parsing_service.async_find_many*
return await parsing_service.async_upsert_one*
return await parsing_service.async_upsert_many*
return await parsing_service.async_delete_one*
return await parsing_service.async_delete_many*
return await result_parser.async_post_redirect_get*
return await result_parser.async_update_one*
return await result_parser.async_patch_many*
return await result_parser.async_update_one*
return await result_parser.async_update_many*
return result
raise FindOneApiNotRegister*
return RedirectResponse.*?redirect_url
raise QueryOperatorNotFound(f'The query operator of {column_name} not found!')
raise InvalidRequestMethod(f'{request_method} is not an available request method')
raise RequestMissing*
raise InvalidRequestMethod.*?f'{value} is not an available request method, Please use CrudMethods
delattr(received_insert, received_insert_item)
delattr(request_or_response_object, name)
routes_source = SQLAlchemyNotSupportRouteSource
query_service = SQLAlchemyNotSupportQueryService
================================================
FILE: .github/workflows/ci.yml
================================================
# This is a basic workflow to help you get started with Actions
name: Unit testing in 🐍3.7/8/9/10
# Controls when the workflow will run
on:
push:
branches: [ "main", "develop", "feature/*" ]
pull_request:
branches: [ "main", "develop" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
ciPython37:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.7 ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Test with unittest
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m unittest discover -s ./tests/test_implementations
ciPython38:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8 ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Test with unittest
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m unittest discover -s ./tests/test_implementations
ciPython39:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.9 ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Test with unittest
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m unittest discover -s ./tests/test_implementations
ciPython310:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Test with unittest
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m unittest discover -s ./tests/test_implementations
================================================
FILE: .github/workflows/coverage.yml
================================================
# This is a basic workflow to help you get started with Actions
name: Coverage
# Controls when the workflow will run
on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Coverage:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@master
- name: Set github token
run: echo "GITHUB_TOKEN=${{ secrets.GIT_TOKEN }}" >> $GITHUB_ENV
- name: Set coveralls token
run: echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: pip install, make coverage
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage
pip install coveralls
python -m coverage run -m unittest
coveralls
================================================
FILE: .github/workflows/release.yml
================================================
# This is a basic workflow to help you get started with Actions
name: Publish Python 🐍 distributions 📦 to PyPI
on:
push:
tags:
- '**'
jobs:
ciPython37:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.7 ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Test with unittest
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m unittest discover -s ./tests/test_implementations
ciPython38:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8 ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Test with unittest
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m unittest discover -s ./tests/test_implementations
ciPython39:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.9 ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Test with unittest
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m unittest discover -s ./tests/test_implementations
ciPython310:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Enable Postgres Trigram Extension
run: |
PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Test with unittest
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test
TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
run: |
python -m unittest discover -s ./tests/test_implementations
build-n-publish:
needs: [ciPython37, ciPython38, ciPython39,ciPython310]
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v3
with:
python-version: "3.7"
- name: Set release version env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Release version
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
================================================
FILE: .gitignore
================================================
/htmlcov/
.coverage
tests/htmlcov
/poetry.lock
/pyproject.toml
*.xml
*.pyc
workspace.xml
*.iml
*.xml
*.sh
*.gz
*.txt
*.
PKG-INFO
fastapi_quickcrud_code_generator_beta.egg-info
src/fastapi_quickcrud.egg-info
dist
================================================
FILE: CHANGELOG.md
================================================
# Change Log
All notable changes to this project will be documented in this file.
## [not release] - 2021-09-27
### FIX
pydantic update is not good for this project
---
## [not release] - 2021-09-27
### Added
Full SQL support
### Changed
### Fixed
### ToDo
upsert for each sql
---
## [not release] - 2021-09-08
### Added
Field description in docs
### Changed
### Fixed
## [0.0.1a16] - 2021-09-08
### Added
relationship with get api
### Changed
disable alias
usage is more easy and quick build up
### Fixed
## [0.0.1a13] - 2021-08-23
### Added
### Changed
### Fixed
post redirect get can not rollback when find one api not found with async session
---
## [0.0.1a12] - 2021-08-23
### Added
support create more than one pydantic model with same
### Changed
### Fixed
duplicated pydantic model name
---
## [Unreleased] - 2021-08-22
### Added
SQLAlchemy Table is supported, but not support alias yet
Support create CRUD route without primary key for SQLAlchemy Table
```python
UntitledTable256 = Table(
'test_table', metadata,
Column('bool_value', Boolean, nullable=False, server_default=text("false")),
Column('bytea_value', LargeBinary),
Column('char_value', CHAR(10)),
Column('date_value', Date, server_default=text("now()")),
Column('float4_value', Float, nullable=False),
Column('float8_value', Float(53), nullable=False, server_default=text("10.10")),
Column('int2_value', SmallInteger, nullable=False),
Column('int4_value', Integer, nullable=False),
Column('int8_value', BigInteger, server_default=text("99")),
Column('interval_value', INTERVAL),
Column('json_value', JSON),
Column('jsonb_value', JSONB(astext_type=Text())),
Column('numeric_value', Numeric),
Column('text_value', Text),
Column('time_value', Time),
Column('timestamp_value', DateTime),
Column('timestamptz_value', DateTime(True)),
Column('timetz_value', Time(True)),
Column('uuid_value', UUID),
Column('varchar_value', String),
Column('array_value', ARRAY(Integer())),
Column('array_str__value', ARRAY(String())),
UniqueConstraint( 'int4_value', 'float4_value'),
)
```
### Changed
- primary key can be optional if autoincrement is True
- get many responses 204 if not found
### Fixed
---
## - 2021-08-20
### Added
### Changed
- primary key will be required if no default value or not nullable
### Fixed
---
## - 2021-08-19
### Added
- User don't need to declare crud_service
### Changed
- query abstract
- Sqlalchemy
- route abstract
### Fixed
When you ask for a specific resource, say a user or with query param, and the user doesn't exist
```https://0.0.0.0:8080/api/:userid```
then fastapi-qucikcrud should return 404. In this case, the client requested a resource that doesn't exist.
----
In the other case, you have an api that returns all users in the system using the following url:
```https://0.0.0.0:8080/api/user```
If there are no users in the system, then, in this case, you should return 204.
---
## - 2021-08-18
### Added
- FastAPIQuickCRUD support commit by user
- for example if autocommit set False
```python
def get_transaction_session():
try:
db = sync_session()
yield db
finally:
db.commit()
db.close()
```
- for example if autocommit set True
```python
def get_transaction_session():
try:
db = sync_session()
yield db
finally:
db.close()
```
### Changed
- Refactor - Separate the sql result parsing
### Fixed
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2021 Luis Lui
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# FastAPI Quick CRUD

[](https://www.codacy.com/gh/LuisLuii/FastAPIQuickCRUD/dashboard?utm_source=github.com&utm_medium=referral&utm_content=LuisLuii/FastAPIQuickCRUD&utm_campaign=Badge_Grade)
[](https://coveralls.io/github/LuisLuii/FastAPIQuickCRUD?branch=main)
[](https://github.com/LuisLuii/FastAPIQuickCRUD/actions/workflows/ci.yml)
[](https://pypi.org/project/fastapi-quickcrud)
[](https://pypi.org/project/fastapi-quickcrud)
[](https://badge.fury.io/py/fastapi-quickcrud)
---
## [If you need apply business logic or add on some code, you can use my another open source project which supports CRUD router code generator](https://github.com/LuisLuii/fastapi-crud-template-generator)
- [Introduction](#introduction)
- [Advantages](#advantages)
- [Limitations](#limitations)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Usage](#usage)
- [Design](#design)
- [Path Parameter](#path-parameter)
- [Query Parameter](#query-parameter)
- [Request Body](#request-body)
- [Foreign Tree](#foreign-tree)
- [Upsert](#upsert)
- [Add description into docs](#add-description-into-docs)
- [Relationship](#relationship)
- [FastAPI_quickcrud Response Status Code standard](#fastapi_quickcrud-response-status-code-standard)
# Introduction
I believe that many people who work with FastApi to build RESTful CRUD services end up wasting time writing repitive boilerplate code.
`FastAPI Quick CRUD` can generate CRUD methods in FastApi from an SQLAlchemy schema:
- Get one
- Get one with foreign key
- Get many
- Get many with foreign key
- Update one
- Update many
- Patch one
- Patch many
- Create/Upsert one
- Create/Upsert many
- Delete One
- Delete Many
- Post Redirect Get
`FastAPI Quick CRUD`is developed based on SQLAlchemy `1.4.23` version and supports sync and async.


## Advantages
- [x] **Support SQLAlchemy 1.4** - Allows you build a fully asynchronous or synchronous python service
- [x] **Full SQLAlchemy DBAPI Support** - Support different SQL for SQLAlchemy
- [x] **Support Pagination** - `Get many` API support `order by` `offset` `limit` field in API
- [x] **Rich FastAPI CRUD router generation** - Many operations of CRUD are implemented to complete the development and coverage of all aspects of basic CRUD.
- [x] **CRUD route automatically generated** - Support Declarative class definitions and Imperative table
- [x] **Flexible API request** - `UPDATE ONE/MANY` `FIND ONE/MANY` `PATCH ONE/MANY` `DELETE ONE/MANY` supports Path Parameters (primary key) and Query Parameters as a command to the resource to filter and limit the scope of the scope of data in request.
- [x] **SQL Relationship** - `FIND ONE/MANY` supports Path get data with relationship
## Limitations
- ❌ If there are multiple **unique constraints**, please use **composite unique constraints** instead
- ❌ **Composite primary key** is not supported
- ❌ Unsupported API requests with on resources `xxx/{primary key}` for tables without a primary key;
- `UPDATE ONE`
- `FIND ONE`
- `PATCH ONE`
- `DELETE ONE`
# Getting started
##
I try to update the version dependencies as soon as possible to ensure that the core dependencies of this project have the highest version possible.
```bash
fastapi<=0.68.2
pydantic<=1.8.2
SQLAlchemy<=1.4.30
starlette==0.14.2
```
## Installation
```bash
pip install fastapi-quickcrud
```
I suggest the following library if you try to connect to PostgreSQL
```bash
pip install psycopg2
pip install asyncpg
```
## Usage
run and go to http://127.0.0.1:port/docs and see the auto-generated API
### Simple Code (or see the longer ([example](https://github.com/LuisLuii/FastAPIQuickCRUD/blob/main/tutorial/sample.py))
```python
from fastapi import FastAPI
from sqlalchemy import Column, Integer, \
String, Table, ForeignKey, orm
from fastapi_quickcrud import crud_router_builder
Base = orm.declarative_base()
class User(Base):
__tablename__ = 'test_users'
id = Column(Integer, primary_key=True, autoincrement=True, unique=True)
name = Column(String, nullable=False)
email = Column(String, nullable=False)
friend = Table(
'test_friend', Base.metadata,
Column('id', ForeignKey('test_users.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False),
Column('friend_name', String, nullable=False)
)
crud_route_1 = crud_router_builder(db_model=User,
prefix="/user",
tags=["User"],
async_mode=True
)
crud_route_2 = crud_router_builder(db_model=friend,
prefix="/friend",
tags=["friend"],
async_mode=True
)
app = FastAPI()
app.include_router(crud_route_1)
app.include_router(crud_route_2)
```
### Foreign Tree With Relationship
```python
from fastapi import FastAPI
from fastapi_quickcrud import crud_router_builder
from sqlalchemy import *
from sqlalchemy.orm import *
from fastapi_quickcrud.crud_router import generic_sql_crud_router_builder
Base = declarative_base()
class Account(Base):
__tablename__ = "account"
id = Column(Integer, primary_key=True, autoincrement=True)
blog_post = relationship("BlogPost", back_populates="account")
class BlogPost(Base):
__tablename__ = "blog_post"
id = Column(Integer, primary_key=True, autoincrement=True)
account_id = Column(Integer, ForeignKey("account.id"), nullable=False)
account = relationship("Account", back_populates="blog_post")
blog_comment = relationship("BlogComment", back_populates="blog_post")
class BlogComment(Base):
__tablename__ = "blog_comment"
id = Column(Integer, primary_key=True, autoincrement=True)
blog_id = Column(Integer, ForeignKey("blog_post.id"), nullable=False)
blog_post = relationship("BlogPost", back_populates="blog_comment")
crud_route_parent = crud_router_builder(
db_model=Account,
prefix="/account",
tags=["account"],
foreign_include=[BlogComment, BlogPost]
)
crud_route_child1 = generic_sql_crud_router_builder(
db_model=BlogPost,
prefix="/blog_post",
tags=["blog_post"],
foreign_include=[BlogComment]
)
crud_route_child2 = generic_sql_crud_router_builder(
db_model=BlogComment,
prefix="/blog_comment",
tags=["blog_comment"]
)
app = FastAPI()
[app.include_router(i) for i in [crud_route_parent, crud_route_child1, crud_route_child2]]
```
### SQLAlchemy to Pydantic Model Converter And Build your own API([example](https://github.com/LuisLuii/FastAPIQuickCRUD/blob/main/tutorial/basic_usage/quick_usage_with_async_SQLALchemy_Base.py))
```python
import uvicorn
from fastapi import FastAPI, Depends
from fastapi_quickcrud import CrudMethods
from fastapi_quickcrud import sqlalchemy_to_pydantic
from fastapi_quickcrud.misc.memory_sql import sync_memory_db
from sqlalchemy import CHAR, Column, Integer
from sqlalchemy.ext.declarative import declarative_base
app = FastAPI()
Base = declarative_base()
metadata = Base.metadata
class Child(Base):
__tablename__ = 'right'
id = Column(Integer, primary_key=True)
name = Column(CHAR, nullable=True)
friend_model_set = sqlalchemy_to_pydantic(db_model=Child,
crud_methods=[
CrudMethods.FIND_MANY,
CrudMethods.UPSERT_MANY,
CrudMethods.UPDATE_MANY,
CrudMethods.DELETE_MANY,
CrudMethods.CREATE_ONE,
CrudMethods.PATCH_MANY,
],
exclude_columns=[])
post_model = friend_model_set.POST[CrudMethods.CREATE_ONE]
sync_memory_db.create_memory_table(Child)
@app.post("/hello",
status_code=201,
tags=["Child"],
response_model=post_model.responseModel,
dependencies=[])
async def my_api(
query: post_model.requestBodyModel = Depends(post_model.requestBodyModel),
session=Depends(sync_memory_db.get_memory_db_session)
):
db_item = Child(**query.__dict__)
session.add(db_item)
session.commit()
session.refresh(db_item)
return db_item.__dict__
uvicorn.run(app, host="0.0.0.0", port=8000, debug=False)
```
* Note:
you can use [sqlacodegen](https://github.com/agronholm/sqlacodegen) to generate SQLAlchemy models for your table. This project is based on the model development and testing generated by sqlacodegen
### Main module
#### Generate CRUD router
**crud_router_builder args**
- db_session [Optional] `execute session generator`
- default using in-memory db with create table automatically
- example:
- sync SQLALchemy:
```python
from sqlalchemy.orm import sessionmaker
def get_transaction_session():
try:
db = sessionmaker(...)
yield db
except Exception as e:
db.rollback()
raise e
finally:
db.close()
```
- Async SQLALchemy
```python
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.asyncio import AsyncSession
async_session = sessionmaker(autocommit=False,
autoflush=False,
bind=engine,
class_=AsyncSession)
async def get_transaction_session() -> AsyncSession:
async with async_session() as session:
async with session.begin():
yield session
```
- db_model [Require] `SQLALchemy Declarative Base Class or Table`
> **Note**: There are some constraint in the SQLALchemy Schema
- async_mode [Optional (auto set by db_session)] `bool`: if your db session is async
> **Note**: require async session generator if True
- autocommit [Optional (default True)] `bool`: if you don't need to commit by your self
> **Note**: require handle the commit in your async session generator if False
- dependencies [Optional]: API dependency injection of fastapi
> **Note**: Get the example usage in `./example`
- crud_methods: ```CrudMethods```
> - CrudMethods.FIND_ONE
> - CrudMethods.FIND_MANY
> - CrudMethods.UPDATE_ONE
> - CrudMethods.UPDATE_MANY
> - CrudMethods.PATCH_ONE
> - CrudMethods.PATCH_MANY
> - CrudMethods.UPSERT_ONE (only support postgresql yet)
> - CrudMethods.UPSERT_MANY (only support postgresql yet)
> - CrudMethods.CREATE_ONE
> - CrudMethods.CREATE_MANY
> - CrudMethods.DELETE_ONE
> - CrudMethods.DELETE_MANY
> - CrudMethods.POST_REDIRECT_GET
- exclude_columns: `list`
> set the columns that not to be operated but the columns should nullable or set the default value)
- foreign_include: `list[declarative_base()]`
> add the SqlAlchemy models here, and build the foreign tree get one/many api (don't support SqlAlchemy table)
- dynamic argument (prefix, tags): extra argument for APIRouter() of fastapi
# Design
In `PUT` `DELETE` `PATCH`, user can use Path Parameters and Query Parameters to limit the scope of the data affected by the operation, and the Query Parameters is same with `FIND` API
## Path Parameter
In the design of this tool, **Path Parameters** should be a primary key of table, that why limited primary key can only be one.
## Query Parameter
- Query Operation will look like that when python type of column is
<details>
<summary>string</summary>
- **support Approximate String Matching that require this**
- (<column_name>____str, <column_name>____str_____matching_pattern)
- **support In-place Operation, get the value of column in the list of input**
- (<column_name>____list, <column_name>____list____comparison_operator)
- **preview**

</details>
<details>
<summary>numeric or datetime</summary>
- **support Range Searching from and to**
- (<column_name>____from, <column_name>____from_____comparison_operator)
- (<column_name>____to, <column_name>____to_____comparison_operator)
- **support In-place Operation, get the value of column in the list of input**
- (<column_name>____list, <column_name>____list____comparison_operator)
- **preview**


</details>
<details>
<summary>uuid</summary>
uuid supports In-place Operation only
- **support In-place Operation, get the value of column in the list of input**
- (<column_name>____list, <column_name>____list____comparison_operator)
</details>
- EXTRA query parameter for `GET_MANY`:
<details>
<summary>Pagination</summary>
- **limit**
- **offset**
- **order by**
- **preview**

</details>
### Query to SQL statement example
- [**Approximate String Matching**](https://www.postgresql.org/docs/9.3/functions-matching.html)
<details>
<summary>example</summary>
- request url
```text
/test_CRUD?
char_value____str_____matching_pattern=match_regex_with_case_sensitive&
char_value____str_____matching_pattern=does_not_match_regex_with_case_insensitive&
char_value____str_____matching_pattern=case_sensitive&
char_value____str_____matching_pattern=not_case_insensitive&
char_value____str=a&
char_value____str=b
```
- generated sql
```sql
SELECT *
FROM untitled_table_256
WHERE (untitled_table_256.char_value ~ 'a') OR
(untitled_table_256.char_value ~ 'b' OR
(untitled_table_256.char_value !~* 'a') OR
(untitled_table_256.char_value !~* 'b' OR
untitled_table_256.char_value LIKE 'a' OR
untitled_table_256.char_value LIKE 'b' OR
untitled_table_256.char_value NOT ILIKE 'a'
OR untitled_table_256.char_value NOT ILIKE 'b'
```
</details>
- **In-place Operation**
<details>
<summary>example</summary>
- In-place support the following operation
- generated sql if user select Equal operation and input True and False
- preview

- generated sql
```sql
select * FROM untitled_table_256
WHERE untitled_table_256.bool_value = true OR
untitled_table_256.bool_value = false
```
</details>
- **Range Searching**
<details>
<summary>example</summary>
- Range Searching support the following operation


- generated sql
```sql
select * from untitled_table_256
WHERE untitled_table_256.date_value > %(date_value_1)s
```
```sql
select * from untitled_table_256
WHERE untitled_table_256.date_value < %(date_value_1)s
```
</details>
- Also support your custom dependency for each api(there is a example in `./example`)
### Request Body
In the design of this tool, the columns of the table will be used as the fields of request body.
In the basic request body in the api generated by this tool, some fields are optional if :
* [x] it is primary key with `autoincrement` is True or the `server_default` or `default` is True
* [x] it is not a primary key, but the `server_default` or `default` is True
* [x] The field is nullable
### Foreign Tree
TBC
## Upsert
** Upsert supports PosgreSQL only yet
POST API will perform the data insertion action with using the basic [Request Body](#request-body),
In addition, it also supports upsert(insert on conflict do)
The operation will use upsert instead if the unique column in the inserted row that is being inserted already exists in the table
The tool uses `unique columns` in the table as a parameter of on conflict , and you can define which column will be updated

## Add description into docs
You can declare `comment` argument for `sqlalchemy.Column` to configure the description of column
example:
```python
class Parent(Base):
__tablename__ = 'parent_o2o'
id = Column(Integer, primary_key=True,comment='parent_test')
# one-to-many collection
children = relationship("Child", back_populates="parent")
class Child(Base):
__tablename__ = 'child_o2o'
id = Column(Integer, primary_key=True,comment='child_pk_test')
parent_id = Column(Integer, ForeignKey('parent_o2o.id'),info=({'description':'child_parent_id_test'}))
# many-to-one scalar
parent = relationship("Parent", back_populates="children")
```
## Relationship
Now, `FIND_ONE` and `FIND_MANY` are supporting select data with join operation
```python
class Parent(Base):
__tablename__ = 'parent_o2o'
id = Column(Integer, primary_key=True)
children = relationship("Child", back_populates="parent")
class Child(Base):
__tablename__ = 'child_o2o'
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey('parent_o2o.id'))
parent = relationship("Parent", back_populates="children")
```
there is a relationship with using back_populates between Parent table and Child table, the `parent_id` in `Child` will refer to `id` column in `Parent`.
`FastApi Quick CRUD` will generate an api with a `join_foreign_table` field, and get api will respond to your selection of the reference data row of the corresponding table in `join_foreign_table` field,


* Try Request
now there are some data in these two table


when i request
* Case One
```commandline
curl -X 'GET' \
'http://0.0.0.0:8000/parent?join_foreign_table=child_o2o' \
-H 'accept: application/json'
```
Response data
```json
[
{
"id_foreign": [
{
"id": 1,
"parent_id": 1
},
{
"id": 2,
"parent_id": 1
}
],
"id": 1
},
{
"id_foreign": [
{
"id": 3,
"parent_id": 2
},
{
"id": 4,
"parent_id": 2
}
],
"id": 2
}
]
```
Response headers
```text
x-total-count: 4
```
There are response 4 data, response data will be grouped by the parent row, if the child refer to the same parent row
* Case Two
```commandline
curl -X 'GET' \
'http://0.0.0.0:8000/child?join_foreign_table=parent_o2o' \
-H 'accept: application/json'
```
Response data
```json
[
{
"parent_id_foreign": [
{
"id": 1
}
],
"id": 1,
"parent_id": 1
},
{
"parent_id_foreign": [
{
"id": 1
}
],
"id": 2,
"parent_id": 1
},
{
"parent_id_foreign": [
{
"id": 2
}
],
"id": 3,
"parent_id": 2
},
{
"parent_id_foreign": [
{
"id": 2
}
],
"id": 4,
"parent_id": 2
}
]
```
Response Header
```text
x-total-count: 4
```
#### FastAPI_quickcrud Response Status Code standard
When you ask for a specific resource, say a user or with query param, and the user doesn't exist
```GET: get one : https://0.0.0.0:8080/api/:userid?xx=xx```
```UPDATE: update one : https://0.0.0.0:8080/api/:userid?xx=xx```
```PATCH: patch one : https://0.0.0.0:8080/api/:userid?xx=xx```
```DELETE: delete one : https://0.0.0.0:8080/api/:userid?xx=xx```
then fastapi-qucikcrud should return 404. In this case, the client requested a resource that doesn't exist.
----
In the other case, you have an api that operate data on batch in the system using the following url:
```GET: get many : https://0.0.0.0:8080/api/user?xx=xx```
```UPDATE: update many : https://0.0.0.0:8080/api/user?xx=xx```
```DELETE: delete many : https://0.0.0.0:8080/api/user?xx=xx```
```PATCH: patch many : https://0.0.0.0:8080/api/user?xx=xx```
If there are no users in the system, then, in this case, you should return 204.
### TODO
[milestones](https://github.com/LuisLuii/FastAPIQuickCRUD/milestones)
================================================
FILE: README_zh.md
================================================
# FastAPI Quick CRUD

[](https://www.codacy.com/gh/LuisLuii/FastAPIQuickCRUD/dashboard?utm_source=github.com&utm_medium=referral&utm_content=LuisLuii/FastAPIQuickCRUD&utm_campaign=Badge_Grade)
[](https://coveralls.io/github/LuisLuii/FastAPIQuickCRUD?branch=main)
[](https://circleci.com/gh/LuisLuii/FastAPIQuickCRUD/tree/main)
[](https://pypi.org/project/fastapi-quickcrud)
[](https://pypi.org/project/fastapi-quickcrud)
[](https://pypi.org/project/fastapi-quickcrud)
[](https://badge.fury.io/py/fastapi-quickcrud)
---
- [Introduction](#introduction)
- [Advantage](#advantage)
- [Constraint](#constraint)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Usage](#usage)
- [Design](#design)
- [Path Parameter](#path-parameter)
- [Query Parameter](#query-parameter)
- [Request Body](#request-body)
- [Upsert](#upsert)
# Introduction
我相信很多人會使用FastAPI寫一些簡單CRUD服務,浪費時間去為每個table 寫高度相似的代碼
如果你使用SQLAlchemy , 你可以通過`FastAPI Quick CRUD` 去生成CRUD API
- Get one
- Get many
- Update one
- Update many
- Patch one
- Patch many
- Create/Upsert one
- Create/Upsert many
- Delete One
- Delete Many
- Post Redirect Get
`FastAPI Quick CRUD`是基於SQLAlchemy `1.4` 版本進行開發,同時支持同步及異步

## 好處
- [x] **支持 SQLAlchemy 1.41版本** - 允許你建立異步或同步的api 服務
- [x] **支持分頁** - Get many API 支持 order by offset limit
- [x] **支持全部SQL DBAPI ** - 支持所有SQLAlchemy 支持的SQL DB dialect
- [x] **CRUD路由自動生成n** - 豐富的CRUD路由生成選擇 - 多種CRUD操作可供選擇
- [x] **CRUD路由自動生成** - 支持SQLAlchemy的 Declarative class definitions 和 Imperative table
- [x] **彈性API 請求** - `UPDATE ONE/MANY` `FIND ONE/MANY` `PATCH ONE/MANY` `DELETE ONE/MANY` 支持利用主鍵作為Path parameter and 以及table的column作Query Parameters,先對數據進行過濾再處理
## 限制
- ❌ 請使用**composite unique constraints** 代替多個**unique constraints**
- ❌ table 只能有一個主鍵
- ❌ 以下API 不支持*Path Parameter* 如果沒有主鍵
- `UPDATE ONE`
- `FIND ONE`
- `PATCH ONE`
- `DELETE ONE`
# Getting started
## Installation
```bash
pip install fastapi-quickcrud
```
#### Simple Code (到 `./example` 取得更多例子)
```python
from fastapi import FastAPI
from sqlalchemy import Column, Integer, \
String, Table, ForeignKey, orm
from fastapi_quickcrud import crud_router_builder
Base = orm.declarative_base()
class User(Base):
__tablename__ = 'test_users'
id = Column(Integer, primary_key=True, autoincrement=True, unique=True)
name = Column(String, nullable=False)
email = Column(String, nullable=False)
friend = Table(
'test_friend', Base.metadata,
Column('id', ForeignKey('test_users.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False),
Column('friend_name', String, nullable=False)
)
crud_route_1 = crud_router_builder(db_model=User,
prefix="/user",
tags=["User"],
async_mode=True
)
crud_route_2 = crud_router_builder(db_model=friend,
prefix="/friend",
tags=["friend"],
async_mode=True
)
app = FastAPI()
app.include_router(crud_route_1)
app.include_router(crud_route_2)
```
### Main module
#### Generate CRUD router
**crud_router_builder args**
- db_session [Optional] `execute session generator`
- 默認使用In-memory DB, 或如以下例子自定義你的數據庫連接
- example:
- 同步 SQLALchemy:
```python
from sqlalchemy.orm import sessionmaker
def get_transaction_session():
try:
db = sessionmaker(...)
yield db
except Exception as e:
db.rollback()
raise e
finally:
db.close()
```
- 異步 SQLALchemy
```python
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.asyncio import AsyncSession
async_session = sessionmaker(autocommit=False,
autoflush=False,
bind=engine,
class_=AsyncSession)
async def get_transaction_session() -> AsyncSession:
async with async_session() as session:
async with session.begin():
yield session
```
- db_model [Require] `SQLALchemy Declarative Base Class or Table`
> **Note**: db_model 會有一些限制,例如數據庫獨特的數據類型
- async_mode [Optional (會通過你的db_session自動判斷)] `bool`: 你的數據庫連接是不是異步
> **Note**: 如果你的數據庫連接是異步,請設置True
- autocommit [Optional (default True)] `bool`: 自動幫你commit每一個 CRUD
> **Note**: 如果你在你的db_session 自已handle 了commit, 請設置False
- dependencies [Optional]: FastAPI 的依赖注入
> **Note**: `./example` 有相關使用例子
- crud_methods [Optional]: ```CrudMethods``` 目前支持的CRUD, 如不設置便會自動設置
> - CrudMethods.FIND_ONE
> - CrudMethods.FIND_MANY
> - CrudMethods.UPDATE_ONE
> - CrudMethods.UPDATE_MANY
> - CrudMethods.PATCH_ONE
> - CrudMethods.PATCH_MANY
> - CrudMethods.UPSERT_ONE (only support postgresql yet)
> - CrudMethods.UPSERT_MANY (only support postgresql yet)
> - CrudMethods.CREATE_ONE
> - CrudMethods.CREATE_MANY
> - CrudMethods.DELETE_ONE
> - CrudMethods.DELETE_MANY
> - CrudMethods.POST_REDIRECT_GET
- exclude_columns: `list`1
> 怱略column,不會生成該怱略column的API請求列
- dynamic argument (prefix, tags): 用作FastApi APIRouter() 的參數
# Design
In `PUT` `DELETE` `PATCH`, 用戶可以通過 Path Parameters and Query Parameters 去限制受影響的數據 ,當中的Query Parameter 跟 `FIND` API一樣
## Path Parameter
在這個工具的設計中,**Path Parameters** 應該是表的一個主鍵,所以有限的主鍵只能是一個。
## Query Parameter
- 當列的 python 類型為時,查詢操作將如下所示
<details>
<summary>string</summary>
- **support Approximate String Matching that require this**
- (<column_name>____str, <column_name>____str_____matching_pattern)
- **support In-place Operation, get the value of column in the list of input**
- (<column_name>____list, <column_name>____list____comparison_operator)
- **preview**

</details>
<details>
<summary>numeric or datetime</summary>
- **support Range Searching from and to**
- (<column_name>____from, <column_name>____from_____comparison_operator)
- (<column_name>____to, <column_name>____to_____comparison_operator)
- **support In-place Operation, get the value of column in the list of input**
- (<column_name>____list, <column_name>____list____comparison_operator)
- **preview**


</details>
<details>
<summary>uuid</summary>
uuid supports In-place Operation only
- **support In-place Operation, get the value of column in the list of input**
- (<column_name>____list, <column_name>____list____comparison_operator)
</details>
- `GET_MANY` 的額外查詢參數:
<details>
<summary>Pagination</summary>
- **limit**
- **offset**
- **order by**
- **preview**

</details>
### Query to SQL statement example
- [**Approximate String Matching**](https://www.postgresql.org/docs/9.3/functions-matching.html)
<details>
<summary>example</summary>
- request url
```text
/test_CRUD?
char_value____str_____matching_pattern=match_regex_with_case_sensitive&
char_value____str_____matching_pattern=does_not_match_regex_with_case_insensitive&
char_value____str_____matching_pattern=case_sensitive&
char_value____str_____matching_pattern=not_case_insensitive&
char_value____str=a&
char_value____str=b
```
- generated sql
```sql
SELECT *
FROM untitled_table_256
WHERE (untitled_table_256.char_value ~ 'a') OR
(untitled_table_256.char_value ~ 'b' OR
(untitled_table_256.char_value !~* 'a') OR
(untitled_table_256.char_value !~* 'b' OR
untitled_table_256.char_value LIKE 'a' OR
untitled_table_256.char_value LIKE 'b' OR
untitled_table_256.char_value NOT ILIKE 'a'
OR untitled_table_256.char_value NOT ILIKE 'b'
```
</details>
- **In-place Operation**
<details>
<summary>example</summary>
- In-place support the following operation
- generated sql if user select Equal operation and input True and False
- preview

- generated sql
```sql
select * FROM untitled_table_256
WHERE untitled_table_256.bool_value = true OR
untitled_table_256.bool_value = false
```
</details>
- **Range Searching**
<details>
<summary>example</summary>
- Range Searching support the following operation


- generated sql
```sql
select * from untitled_table_256
WHERE untitled_table_256.date_value > %(date_value_1)s
```
```sql
select * from untitled_table_256
WHERE untitled_table_256.date_value < %(date_value_1)s
```
</details>
- 還支持您對每個 api 的自定義依賴項(there is a example in `./example`)
### 請求正文
在這個工具的設計中,表格的列將被用作請求正文的字段。
在此工俱生成的 api 中的基本請求正文中,某些字段是可選的,如果:
* [x] 它是主鍵,`autoincrement` 為 True 或 `server_default` 或 `default` 為 True
* [x] 它不是主鍵,但 `server_default` 或 `default` 為 True
* [x] 該字段可以為空
## Upsert
** Upsert 目前僅支持 PosgreSQL
POST API 將使用基本的 [Request Body](#request-body) 執行數據插入操作,
此外,它還支持upsert(在衝突時插入)
如果要插入的插入行中的唯一列已存在於表中,則該操作將使用 upsert
該工具使用表中的“唯一列”作為衝突時的參數,您可以定義將更新哪一列

## Add description into docs
你可以為`sqlalchemy.Column`聲明`comment`參數來配置列的描述
例子:
```python
class Parent(Base):
__tablename__ = 'parent_o2o'
id = Column(Integer, primary_key=True,comment='parent_test')
# one-to-many collection
children = relationship("Child", back_populates="parent")
class Child(Base):
__tablename__ = 'child_o2o'
id = Column(Integer, primary_key=True,comment='child_pk_test')
parent_id = Column(Integer, ForeignKey('parent_o2o.id'),info=({'description':'child_parent_id_test'}))
# many-to-one scalar
parent = relationship("Parent", back_populates="children")
```
## Relationship
現在,`FIND_ONE` 和 `FIND_MANY` 支持 relationship
```python
class Parent(Base):
__tablename__ = 'parent_o2o'
id = Column(Integer, primary_key=True)
children = relationship("Child", back_populates="parent")
class Child(Base):
__tablename__ = 'child_o2o'
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey('parent_o2o.id'))
parent = relationship("Parent", back_populates="children")
```
父表和子表之間使用back_populates有關係,`Child`中的`parent_id`將引用`Parent`中的`id`列。
`FastApi Quick CRUD`會生成一個帶有`join_foreign_table`字段的api,get api會響應你在`join_foreign_table`字段中選擇對應表的引用數據行,


* Try Request
現在這兩個表中有一些數據


當我請求時
* Case One
```commandline
curl -X 'GET' \
'http://0.0.0.0:8000/parent?join_foreign_table=child_o2o' \
-H 'accept: application/json'
```
Response data
```json
[
{
"id_foreign": [
{
"id": 1,
"parent_id": 1
},
{
"id": 2,
"parent_id": 1
}
],
"id": 1
},
{
"id_foreign": [
{
"id": 3,
"parent_id": 2
},
{
"id": 4,
"parent_id": 2
}
],
"id": 2
}
]
```
Response headers
```text
x-total-count: 4
```
這有響應四個數據,響應數據將按父行分組,如果子引用相同的父行
* Case Two
```commandline
curl -X 'GET' \
'http://0.0.0.0:8000/child?join_foreign_table=parent_o2o' \
-H 'accept: application/json'
```
Response data
```json
[
{
"parent_id_foreign": [
{
"id": 1
}
],
"id": 1,
"parent_id": 1
},
{
"parent_id_foreign": [
{
"id": 1
}
],
"id": 2,
"parent_id": 1
},
{
"parent_id_foreign": [
{
"id": 2
}
],
"id": 3,
"parent_id": 2
},
{
"parent_id_foreign": [
{
"id": 2
}
],
"id": 4,
"parent_id": 2
}
]
```
Response Header
```text
x-total-count: 4
```
#### FastAPI_quickcrud Response Status Code standard
當您請求特定資源時,例如一個用戶或帶有查詢參數,而該用戶不存在
```GET: get one : https://0.0.0.0:8080/api/:userid?xx=xx```
```UPDATE: update one : https://0.0.0.0:8080/api/:userid?xx=xx```
```PATCH: patch one : https://0.0.0.0:8080/api/:userid?xx=xx```
```DELETE: delete one : https://0.0.0.0:8080/api/:userid?xx=xx```
那麼 fastapi-qucikcrud 應該返回 404。在這種情況下,客戶端請求了一個不存在的資源。
----
在另一種情況下,您有一個 api,它使用以下 url 在系統中批量操作數據:
```GET: get many : https://0.0.0.0:8080/api/user?xx=xx```
```UPDATE: update many : https://0.0.0.0:8080/api/user?xx=xx```
```DELETE: delete many : https://0.0.0.0:8080/api/user?xx=xx```
```PATCH: patch many : https://0.0.0.0:8080/api/user?xx=xx```
如果系統中沒有用戶,那麼在這種情況下,您應該返回 204。
### TODO
- 每個 SQL 的 Upsert 操作
================================================
FILE: __init__.py
================================================
================================================
FILE: __main__.py
================================================
================================================
FILE: setup.py
================================================
import os
from setuptools import setup, find_packages
VERSION = os.getenv("RELEASE_VERSION", default=None) or os.getenv("env.RELEASE_VERSION", default=None)
print(
"""
- upload
- build wheel: python setup.py sdist
- upload to server: twine upload dist/*
- download
- Just pip install <package>
"""
)
if __name__ == "__main__":
setup(
name="fastapi_quickcrud",
version=VERSION,
install_requires=[
"fastapi==0.68.2",
"pydantic==1.8.2",
"SQLAlchemy==1.4.30",
"StrEnum==0.4.7",
"starlette==0.14.2",
"aiosqlite==0.17.0",
],
extras_require={
'dev': [
"uvicorn==0.17.0",
"greenlet==1.1.2",
"anyio==3.5.0"
],
},
python_requires=">=3.7",
description="A comprehensive FastaAPI's CRUD router generator for SQLALchemy.",
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
author="Luis Lui",
author_email="luis11235178@gmail.com",
url="https://github.com/LuisLuii/FastAPIQuickCRUD",
license="MIT License",
keywords=[
"fastapi",
"crud",
"restful",
"routing",
"SQLAlchemy",
"generator",
"crudrouter",
"postgresql",
"builder",
],
packages=find_packages("src"),
package_dir={"": "src"},
setup_requires=["setuptools>=31.6.0"],
classifiers=[
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Code Generators",
"Topic :: Software Development",
"Typing :: Typed",
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: AsyncIO",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Internet :: WWW/HTTP",
],
include_package_data=True,
)
================================================
FILE: src/__init__.py
================================================
================================================
FILE: src/fastapi_quickcrud/__init__.py
================================================
from .misc.utils import sqlalchemy_to_pydantic
from .crud_router import crud_router_builder
from .misc.type import CrudMethods
================================================
FILE: src/fastapi_quickcrud/crud_router.py
================================================
import asyncio
import inspect
from functools import partial
from typing import \
Any, \
List, \
TypeVar, Union, Callable, Optional
from fastapi import \
Depends, APIRouter
from pydantic import \
BaseModel
from sqlalchemy.sql.schema import Table
from . import sqlalchemy_to_pydantic
from .misc.abstract_execute import SQLALchemyExecuteService
from .misc.abstract_parser import SQLAlchemyGeneralSQLeResultParse
from .misc.abstract_query import SQLAlchemyPGSQLQueryService, \
SQLAlchemySQLITEQueryService, SQLAlchemyNotSupportQueryService
from .misc.abstract_route import SQLAlchemySQLLiteRouteSource, SQLAlchemyPGSQLRouteSource, \
SQLAlchemyNotSupportRouteSource
from .misc.crud_model import CRUDModel
from .misc.memory_sql import async_memory_db, sync_memory_db
from .misc.type import CrudMethods, SqlType
from .misc.utils import convert_table_to_model, Base
CRUDModelType = TypeVar("CRUDModelType", bound=BaseModel)
CompulsoryQueryModelType = TypeVar("CompulsoryQueryModelType", bound=BaseModel)
OnConflictModelType = TypeVar("OnConflictModelType", bound=BaseModel)
def crud_router_builder(
*,
db_model: Union[Table, 'DeclarativeBaseModel'],
db_session: Callable = None,
autocommit: bool = True,
crud_methods: Optional[List[CrudMethods]] = None,
exclude_columns: Optional[List[str]] = None,
dependencies: Optional[List[callable]] = None,
crud_models: Optional[CRUDModel] = None,
async_mode: Optional[bool] = None,
foreign_include: Optional[Base] = None,
sql_type: Optional[SqlType] = None,
**router_kwargs: Any) -> APIRouter:
"""
@param db_model:
The Sqlalchemy Base model/Table you want to use it to build api.
@param db_session:
The callable variable and return a session generator that will be used to get database connection session for fastapi.
@param autocommit:
set False if you handle commit in your db_session.
@param crud_methods:
Fastapi Quick CRUD supports a few of crud methods, and they save into the Enum class,
get it by : from fastapi_quickcrud import CrudMethods
example:
[CrudMethods.GET_MANY,CrudMethods.ONE]
note:
if there is no primary key in your SQLAlchemy model, it dose not support request with
specific resource, such as GET_ONE, UPDATE_ONE, DELETE_ONE, PATCH_ONE AND POST_REDIRECT_GET
this is because POST_REDIRECT_GET need to redirect to GET_ONE api
@param exclude_columns:
Fastapi Quick CRUD will get all the columns in you table to generate a CRUD router,
it is allow you exclude some columns you dont want it expose to operated by API
note:
if the column in exclude list but is it not nullable or no default_value, it may throw error
when you do insert
@param dependencies:
A variable that will be added to the path operation decorators.
@param crud_models:
You can use the sqlalchemy_to_pydantic() to build your own Pydantic model CRUD set
@param async_mode:
As your database connection
@param foreign_include: BaseModel
Used to build foreign tree api
@param sql_type:
You sql database type
@param router_kwargs:
other argument for FastApi's views
@return:
APIRouter for fastapi
"""
db_model, NO_PRIMARY_KEY = convert_table_to_model(db_model)
constraints = db_model.__table__.constraints
if db_session is None:
if async_mode:
db_connection = async_memory_db
db_session: Callable = db_connection.async_get_memory_db_session
else:
db_connection = sync_memory_db
db_session: Callable = db_connection.get_memory_db_session
db_connection.create_memory_table(db_model)
if async_mode is None:
async_mode = inspect.isasyncgen(db_session())
if sql_type is None:
async def async_runner(f):
return [i.bind.name async for i in f()]
try:
if async_mode:
sql_type, = asyncio.get_event_loop().run_until_complete(async_runner(db_session))
else:
sql_type, = [i.bind.name for i in db_session()]
except Exception:
raise RuntimeError("Some unknown problem occurred error, maybe you are uvicorn.run with reload=True. "
"Try declaring sql_type for crud_router_builder yourself using from fastapi_quickcrud.misc.type import SqlType")
if not crud_methods and NO_PRIMARY_KEY == False:
crud_methods = CrudMethods.get_declarative_model_full_crud_method()
if not crud_methods and NO_PRIMARY_KEY == True:
crud_methods = CrudMethods.get_table_full_crud_method()
result_parser_builder = SQLAlchemyGeneralSQLeResultParse
if sql_type == SqlType.sqlite:
routes_source = SQLAlchemySQLLiteRouteSource
query_service = SQLAlchemySQLITEQueryService
elif sql_type == SqlType.postgresql:
routes_source = SQLAlchemyPGSQLRouteSource
query_service = SQLAlchemyPGSQLQueryService
else:
routes_source = SQLAlchemyNotSupportRouteSource
query_service = SQLAlchemyNotSupportQueryService
if not crud_models:
crud_models_builder: CRUDModel = sqlalchemy_to_pydantic
crud_models: CRUDModel = crud_models_builder(db_model=db_model,
constraints=constraints,
crud_methods=crud_methods,
exclude_columns=exclude_columns,
sql_type=sql_type,
foreign_include=foreign_include,
exclude_primary_key=NO_PRIMARY_KEY)
foreign_table_mapping = {db_model.__tablename__: db_model}
if foreign_include:
for i in foreign_include:
model , _= convert_table_to_model(i)
foreign_table_mapping[model.__tablename__] = i
crud_service = query_service(model=db_model, async_mode=async_mode, foreign_table_mapping=foreign_table_mapping)
# else:
# crud_service = SQLAlchemyPostgreQueryService(model=db_model, async_mode=async_mode)
result_parser = result_parser_builder(async_model=async_mode,
crud_models=crud_models,
autocommit=autocommit)
methods_dependencies = crud_models.get_available_request_method()
primary_name = crud_models.PRIMARY_KEY_NAME
if primary_name:
path = '/{' + primary_name + '}'
else:
path = ""
unique_list: List[str] = crud_models.UNIQUE_LIST
execute_service = SQLALchemyExecuteService()
def find_one_api(request_response_model: dict, dependencies):
_request_query_model = request_response_model.get('requestQueryModel', None)
_response_model = request_response_model.get('responseModel', None)
_request_url_param_model = request_response_model.get('requestUrlParamModel', None)
routes_source.find_one(path=path,
request_url_param_model=_request_url_param_model,
request_query_model=_request_query_model,
response_model=_response_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
async_mode=async_mode)
def find_many_api(request_response_model: dict, dependencies):
_request_query_model = request_response_model.get('requestQueryModel', None)
_response_model = request_response_model.get('responseModel', None)
routes_source.find_many(path="",
request_query_model=_request_query_model,
response_model=_response_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
async_mode=async_mode)
def upsert_one_api(request_response_model: dict, dependencies):
_request_body_model = request_response_model.get('requestBodyModel', None)
_response_model = request_response_model.get('responseModel', None)
routes_source.upsert_one(path="",
request_body_model=_request_body_model,
response_model=_response_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
async_mode=async_mode,
unique_list=unique_list)
def upsert_many_api(request_response_model: dict, dependencies):
_request_body_model = request_response_model.get('requestBodyModel', None)
_response_model = request_response_model.get('responseModel', None)
routes_source.upsert_many(path="",
request_body_model=_request_body_model,
response_model=_response_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
unique_list=unique_list,
async_mode=async_mode)
def create_one_api(request_response_model: dict, dependencies):
_request_body_model = request_response_model.get('requestBodyModel', None)
_response_model = request_response_model.get('responseModel', None)
routes_source.create_one(path="",
request_body_model=_request_body_model,
response_model=_response_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
async_mode=async_mode,
unique_list=unique_list)
def create_many_api(request_response_model: dict, dependencies):
_request_body_model = request_response_model.get('requestBodyModel', None)
_response_model = request_response_model.get('responseModel', None)
routes_source.create_many(path="",
request_body_model=_request_body_model,
response_model=_response_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
unique_list=unique_list,
async_mode=async_mode)
def delete_one_api(request_response_model: dict, dependencies):
_request_query_model = request_response_model.get('requestQueryModel', None)
_request_url_model = request_response_model.get('requestUrlParamModel', None)
_response_model = request_response_model.get('responseModel', None)
routes_source.delete_one(path=path,
request_query_model=_request_query_model,
request_url_model=_request_url_model,
response_model=_response_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
async_mode=async_mode)
def delete_many_api(request_response_model: dict, dependencies):
_request_query_model = request_response_model.get('requestQueryModel', None)
_response_model = request_response_model.get('responseModel', None)
routes_source.delete_many(path="",
request_query_model=_request_query_model,
response_model=_response_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
async_mode=async_mode)
def post_redirect_get_api(request_response_model: dict, dependencies):
_request_body_model = request_response_model.get('requestBodyModel', None)
_response_model = request_response_model.get('responseModel', None)
routes_source.post_redirect_get(api=api,
dependencies=dependencies,
request_body_model=_request_body_model,
db_session=db_session,
crud_service=crud_service,
result_parser=result_parser,
execute_service=execute_service,
async_mode=async_mode,
response_model=_response_model)
def patch_one_api(request_response_model: dict, dependencies):
_request_query_model = request_response_model.get('requestQueryModel', None)
_response_model = request_response_model.get('responseModel', None)
_request_body_model = request_response_model.get('requestBodyModel', None)
_request_url_param_model = request_response_model.get('requestUrlParamModel', None)
routes_source.patch_one(api=api,
path=path,
request_url_param_model=_request_url_param_model,
request_query_model=_request_query_model,
dependencies=dependencies,
request_body_model=_request_body_model,
db_session=db_session,
crud_service=crud_service,
result_parser=result_parser,
execute_service=execute_service,
async_mode=async_mode,
response_model=_response_model)
def patch_many_api(request_response_model: dict, dependencies):
_request_query_model = request_response_model.get('requestQueryModel', None)
_response_model = request_response_model.get('responseModel', None)
_request_body_model = request_response_model.get('requestBodyModel', None)
routes_source.patch_many(api=api,
path="",
request_query_model=_request_query_model,
dependencies=dependencies,
request_body_model=_request_body_model,
db_session=db_session,
crud_service=crud_service,
result_parser=result_parser,
execute_service=execute_service,
async_mode=async_mode,
response_model=_response_model)
def put_one_api(request_response_model: dict, dependencies):
_request_query_model = request_response_model.get('requestQueryModel', None)
_response_model = request_response_model.get('responseModel', None)
_request_body_model = request_response_model.get('requestBodyModel', None)
_request_url_param_model = request_response_model.get('requestUrlParamModel', None)
routes_source.put_one(api=api,
path=path,
request_query_model=_request_query_model,
dependencies=dependencies,
request_body_model=_request_body_model,
db_session=db_session,
crud_service=crud_service,
result_parser=result_parser,
execute_service=execute_service,
async_mode=async_mode,
response_model=_response_model,
request_url_param_model=_request_url_param_model)
def put_many_api(request_response_model: dict, dependencies):
_request_query_model = request_response_model.get('requestQueryModel', None)
_response_model = request_response_model.get('responseModel', None)
_request_body_model = request_response_model.get('requestBodyModel', None)
routes_source.put_many(api=api,
path='',
request_query_model=_request_query_model,
dependencies=dependencies,
request_body_model=_request_body_model,
db_session=db_session,
crud_service=crud_service,
result_parser=result_parser,
execute_service=execute_service,
async_mode=async_mode,
response_model=_response_model)
def find_one_foreign_tree_api(request_response_model: dict, dependencies):
_foreign_list_model = request_response_model.get('foreignListModel', None)
for i in _foreign_list_model:
_request_query_model = i["request_query_model"]
_response_model = i["response_model"]
_path = i["path"]
_function_name = i["function_name"]
request_url_param_model = i["primary_key_dataclass_model"]
routes_source.find_one_foreign_tree(path=_path,
request_query_model=_request_query_model,
response_model=_response_model,
request_url_param_model=request_url_param_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
function_name=_function_name,
async_mode=async_mode)
def find_many_foreign_tree_api(request_response_model: dict, dependencies):
_foreign_list_model = request_response_model.get('foreignListModel', None)
for i in _foreign_list_model:
_request_query_model = i["request_query_model"]
_response_model = i["response_model"]
_path = i["path"]
_function_name = i["function_name"]
request_url_param_model = i["primary_key_dataclass_model"]
routes_source.find_many_foreign_tree(path=_path,
request_query_model=_request_query_model,
response_model=_response_model,
request_url_param_model=request_url_param_model,
db_session=db_session,
query_service=crud_service,
parsing_service=result_parser,
execute_service=execute_service,
dependencies=dependencies,
api=api,
async_mode=async_mode,
function_name=_function_name)
api_register = {
CrudMethods.FIND_ONE.value: find_one_api,
CrudMethods.FIND_MANY.value: find_many_api,
CrudMethods.UPSERT_ONE.value: upsert_one_api,
CrudMethods.UPSERT_MANY.value: upsert_many_api,
CrudMethods.CREATE_MANY.value: create_many_api,
CrudMethods.CREATE_ONE.value: create_one_api,
CrudMethods.DELETE_ONE.value: delete_one_api,
CrudMethods.DELETE_MANY.value: delete_many_api,
CrudMethods.POST_REDIRECT_GET.value: post_redirect_get_api,
CrudMethods.PATCH_ONE.value: patch_one_api,
CrudMethods.PATCH_MANY.value: patch_many_api,
CrudMethods.UPDATE_ONE.value: put_one_api,
CrudMethods.UPDATE_MANY.value: put_many_api,
CrudMethods.FIND_ONE_WITH_FOREIGN_TREE.value: find_one_foreign_tree_api,
CrudMethods.FIND_MANY_WITH_FOREIGN_TREE.value: find_many_foreign_tree_api
}
api = APIRouter(**router_kwargs)
if dependencies is None:
dependencies = []
dependencies = [Depends(dep) for dep in dependencies]
for request_method in methods_dependencies:
value_of_dict_crud_model = crud_models.get_model_by_request_method(request_method)
crud_model_of_this_request_methods = value_of_dict_crud_model.keys()
for crud_model_of_this_request_method in crud_model_of_this_request_methods:
request_response_model_of_this_request_method = value_of_dict_crud_model[crud_model_of_this_request_method]
api_register[crud_model_of_this_request_method.value](request_response_model_of_this_request_method,
dependencies)
return api
pgsql_crud_router_builder = partial(crud_router_builder)
generic_sql_crud_router_builder = partial(crud_router_builder)
================================================
FILE: src/fastapi_quickcrud/misc/__init__.py
================================================
================================================
FILE: src/fastapi_quickcrud/misc/abstract_execute.py
================================================
from typing import Any
from sqlalchemy.sql.elements import BinaryExpression
class SQLALchemyExecuteService(object):
def __init__(self):
pass
# @staticmethod
# async def async_execute_and_expire(session, stmt: BinaryExpression) -> Any:
# async_execute_and_expire_result = await session.execute(stmt)
# session.expire_all()
# return async_execute_and_expire_result
#
# @staticmethod
# def execute_and_expire(session, stmt: BinaryExpression) -> Any:
# execute_and_expire_result = session.execute(stmt)
# session.expire_all()
# return execute_and_expire_result
@staticmethod
def add(session, model) -> Any:
session.add(model)
@staticmethod
def add_all(session, model) -> Any:
session.add_all(model)
@staticmethod
async def async_flush(session) -> Any:
await session.flush()
@staticmethod
def flush(session) -> Any:
session.flush()
@staticmethod
async def async_execute(session, stmt: BinaryExpression) -> Any:
return await session.execute(stmt)
@staticmethod
def execute(session, stmt: BinaryExpression) -> Any:
return session.execute(stmt)
================================================
FILE: src/fastapi_quickcrud/misc/abstract_parser.py
================================================
import copy
from http import HTTPStatus
from urllib.parse import urlencode
from pydantic import parse_obj_as
from starlette.responses import Response, RedirectResponse
from .utils import group_find_many_join
from .exceptions import FindOneApiNotRegister
class SQLAlchemyGeneralSQLeResultParse(object):
def __init__(self, async_model, crud_models, autocommit):
"""
:param async_model: bool
:param crud_models: pre ready
:param autocommit: bool
"""
self.async_mode = async_model
self.crud_models = crud_models
self.primary_name = crud_models.PRIMARY_KEY_NAME
self.autocommit = autocommit
async def async_commit(self, session):
await session.flush()
if self.autocommit:
await session.commit()
def commit(self, session):
session.flush()
if self.autocommit:
session.commit()
async def async_delete(self, session, data):
await session.delete(data)
def delete(self, session, data):
session.delete(data)
def update_data_model(self, data, update_args):
for update_arg_name, update_arg_value in update_args.items():
setattr(data, update_arg_name, update_arg_value)
return data
@staticmethod
async def async_rollback(session):
await session.rollback()
@staticmethod
def rollback(session):
session.rollback()
@staticmethod
def _response_builder(sql_execute_result, fastapi_response, response_model):
result = parse_obj_as(response_model, sql_execute_result)
fastapi_response.headers["x-total-count"] = str(len(sql_execute_result) if isinstance(sql_execute_result, list)
else '1')
return result
# async def async_update_many(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
# result = self._response_builder(sql_execute_result, fastapi_response, response_model)
# await self.async_commit(kwargs.get('session'))
# return result
#
# async def async_patch_many(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
# result = self._response_builder(sql_execute_result, fastapi_response, response_model)
# await self.async_commit(kwargs.get('session'))
# return result
#
# def patch_many(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
# result = self._response_builder(sql_execute_result, fastapi_response, response_model)
# self.commit(kwargs.get('session'))
# return result
def update_func(self, response_model, sql_execute_result, fastapi_response, update_args, update_one):
if not isinstance(sql_execute_result, list):
sql_execute_result = [sql_execute_result]
tmp = []
for i in sql_execute_result:
tmp.append(self.update_data_model(i, update_args=update_args))
if not update_one:
sql_execute_result = tmp
else:
sql_execute_result, = tmp
return self._response_builder(response_model=response_model,
sql_execute_result=sql_execute_result,
fastapi_response=fastapi_response)
def update(self, *, response_model, sql_execute_result, fastapi_response, update_args, **kwargs):
session = kwargs.get('session')
update_one = kwargs.get('update_one')
result = self.update_func(response_model, sql_execute_result, fastapi_response, update_args, update_one)
self.commit(session)
return result
async def async_update(self, *, response_model, sql_execute_result, fastapi_response, update_args, **kwargs):
session = kwargs.get('session')
update_one = kwargs.get('update_one')
result = self.update_func(response_model, sql_execute_result, fastapi_response, update_args, update_one)
await self.async_commit(session)
return result
@staticmethod
def find_one_sub_func(sql_execute_result, response_model, fastapi_response, **kwargs):
join = kwargs.get('join_mode', None)
one_row_data = sql_execute_result.fetchall()
if not one_row_data:
return Response('specific data not found', status_code=HTTPStatus.NOT_FOUND)
response = []
for i in one_row_data:
i = dict(i)
result__ = copy.deepcopy(i)
tmp = {}
for key_, value_ in result__.items():
if '_____' in key_:
key, foreign_column = key_.split('_____')
if key not in tmp:
tmp[key] = {foreign_column: value_}
else:
tmp[key][foreign_column] = value_
else:
tmp[key_] = value_
response.append(tmp)
if join:
response = group_find_many_join(response)
if isinstance(response, list):
response = response[0]
fastapi_response.headers["x-total-count"] = str(1)
return response
async def async_find_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.find_one_sub_func(sql_execute_result, response_model, fastapi_response, **kwargs)
await self.async_commit(kwargs.get('session'))
return result
def find_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.find_one_sub_func(sql_execute_result, response_model, fastapi_response, **kwargs)
self.commit(kwargs.get('session'))
return result
@staticmethod
def find_many_sub_func(response_model, sql_execute_result, fastapi_response, **kwargs):
join = kwargs.get('join_mode', None)
result = sql_execute_result.fetchall()
if not result:
return Response(status_code=HTTPStatus.NO_CONTENT)
response = []
for i in result:
i = dict(i)
result__ = copy.deepcopy(i)
tmp = {}
for key_, value_ in result__.items():
if '_____' in key_:
key, foreign_column = key_.split('_____')
if key not in tmp:
tmp[key] = {foreign_column: value_}
else:
tmp[key][foreign_column] = value_
else:
tmp[key_] = value_
response.append(tmp)
fastapi_response.headers["x-total-count"] = str(len(response))
if join:
response = group_find_many_join(response)
response = parse_obj_as(response_model, response)
return response
async def async_find_many(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.find_many_sub_func(response_model, sql_execute_result, fastapi_response, **kwargs)
await self.async_commit(kwargs.get('session'))
return result
def find_many(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.find_many_sub_func(response_model, sql_execute_result, fastapi_response, **kwargs)
self.commit(kwargs.get('session'))
return result
# @staticmethod
# def update_one_sub_func(response_model, sql_execute_result, fastapi_response):
# result = parse_obj_as(response_model, sql_execute_result)
# fastapi_response.headers["x-total-count"] = str(1)
# return result
#
# async def async_update_one(self, *, response_model, sql_execute_result, fastapi_response, update_args, **kwargs):
# session = kwargs.get('session')
# if not sql_execute_result:
# return Response(status_code=HTTPStatus.NOT_FOUND)
# data = self.update_data_model(sql_execute_result, update_args=update_args)
# result = self.update_one_sub_func(response_model, data, fastapi_response)
# await self.commit(session)
# return result
#
# def update_one(self, *, response_model, sql_execute_result, fastapi_response, update_args, **kwargs):
# session = kwargs.get('session')
# if not sql_execute_result:
# return Response(status_code=HTTPStatus.NOT_FOUND)
# data = self.update_data_model(sql_execute_result, update_args=update_args)
# result = self.update_one_sub_func(response_model, data, fastapi_response)
# self.commit(session)
# return result
# async def async_patch_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
# result = self.update_one_sub_func(response_model, sql_execute_result, fastapi_response)
# await self.async_commit(kwargs.get('session'))
# return result
#
# def patch_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
# result = self.update_one_sub_func(response_model, sql_execute_result, fastapi_response)
# self.commit(kwargs.get('session'))
# return result
@staticmethod
def create_one_sub_func(response_model, sql_execute_result, fastapi_response):
inserted_data, = sql_execute_result
result = parse_obj_as(response_model, inserted_data)
fastapi_response.headers["x-total-count"] = str(1)
return result
async def async_create_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.create_one_sub_func(response_model, sql_execute_result, fastapi_response)
await self.async_commit(kwargs.get('session'))
return result
def create_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.create_one_sub_func(response_model, sql_execute_result, fastapi_response)
self.commit(kwargs.get('session'))
return result
@staticmethod
def create_many_sub_func(response_model, sql_execute_result, fastapi_response):
result = parse_obj_as(response_model, sql_execute_result)
fastapi_response.headers["x-total-count"] = str(len(sql_execute_result))
return result
async def async_create_many(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.create_many_sub_func(response_model, sql_execute_result, fastapi_response)
await self.async_commit(kwargs.get('session'))
return result
def create_many(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.create_many_sub_func(response_model, sql_execute_result, fastapi_response)
self.commit(kwargs.get('session'))
return result
@staticmethod
def upsert_one_sub_func(response_model, sql_execute_result, fastapi_response):
sql_execute_result = sql_execute_result.fetchone()
result = parse_obj_as(response_model, dict(sql_execute_result))
fastapi_response.headers["x-total-count"] = str(1)
return result
async def async_upsert_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.upsert_one_sub_func(response_model, sql_execute_result, fastapi_response)
await self.async_commit(kwargs.get('session'))
return result
def upsert_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.upsert_one_sub_func(response_model, sql_execute_result, fastapi_response)
self.commit(kwargs.get('session'))
return result
@staticmethod
def upsert_many_sub_func(response_model, sql_execute_result, fastapi_response):
insert_result_list = sql_execute_result.fetchall()
result = parse_obj_as(response_model, insert_result_list)
fastapi_response.headers["x-total-count"] = str(len(insert_result_list))
return result
async def async_upsert_many(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.upsert_many_sub_func(response_model, sql_execute_result, fastapi_response)
await self.async_commit(kwargs.get('session'))
return result
def upsert_many(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
result = self.upsert_many_sub_func(response_model, sql_execute_result, fastapi_response)
self.commit(kwargs.get('session'))
return result
def delete_one_sub_func(self, response_model, sql_execute_result, fastapi_response, **kwargs):
if not sql_execute_result:
return Response(status_code=HTTPStatus.NOT_FOUND)
result = parse_obj_as(response_model, sql_execute_result)
fastapi_response.headers["x-total-count"] = str(1)
return result
def delete_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
session = kwargs.get('session')
if sql_execute_result:
self.delete(session, sql_execute_result)
result = self.delete_one_sub_func(response_model, sql_execute_result, fastapi_response, **kwargs)
self.commit(session)
return result
async def async_delete_one(self, *, response_model, sql_execute_result, fastapi_response, **kwargs):
session = kwargs.get('session')
if sql_execute_result:
self.delete(session, sql_execute_result)
result = self.delete_one_sub_func(response_model, sql_execute_result, fastapi_response, **kwargs)
await self.async_commit(session)
return result
def delete_many_sub_func(self, response_model, sql_execute_result, fastapi_response):
if not sql_execute_result:
return Response(status_code=HTTPStatus.NO_CONTENT)
deleted_rows = sql_execute_result
result = parse_obj_as(response_model, deleted_rows)
fastapi_response.headers["x-total-count"] = str(len(deleted_rows))
return result
def delete_many(self, *, response_model, sql_execute_results, fastapi_response, **kwargs):
session = kwargs.get('session')
if sql_execute_results:
for sql_execute_result in sql_execute_results:
self.delete(session, sql_execute_result)
result = self.delete_many_sub_func(response_model, sql_execute_results, fastapi_response)
self.commit(session)
return result
async def async_delete_many(self, *, response_model, sql_execute_results, fastapi_response, **kwargs):
session = kwargs.get('session')
if sql_execute_results:
for sql_execute_result in sql_execute_results:
await self.async_delete(session, sql_execute_result)
result = self.delete_many_sub_func(response_model, sql_execute_results, fastapi_response)
await self.async_commit(session)
return result
def has_end_point(self, fastapi_request) -> bool:
redirect_end_point = fastapi_request.url.path + "/{" + self.primary_name + "}"
redirect_url_exist = False
for route in fastapi_request.app.routes:
if route.path == redirect_end_point:
route_request_method, = route.methods
if route_request_method.upper() == 'GET':
redirect_url_exist = True
return redirect_url_exist
def post_redirect_get_sub_func(self, response_model, sql_execute_result, fastapi_request):
result = parse_obj_as(response_model, sql_execute_result)
primary_key_field = result.__dict__.pop(self.primary_name, None)
assert primary_key_field is not None
redirect_url = fastapi_request.url.path + "/" + str(primary_key_field)
return redirect_url
def get_post_redirect_get_url(self, response_model, sql_execute_result, fastapi_request):
redirect_url = self.post_redirect_get_sub_func(response_model, sql_execute_result, fastapi_request)
header_dict = {i[0].decode("utf-8"): i[1].decode("utf-8") for i in fastapi_request.headers.__dict__['_list']}
redirect_url += f'?{urlencode(header_dict)}'
return redirect_url
async def async_post_redirect_get(self, *, response_model, sql_execute_result, fastapi_request, **kwargs):
session = kwargs['session']
if not self.has_end_point(fastapi_request):
await self.async_rollback(session)
raise FindOneApiNotRegister(404,
f'End Point {fastapi_request.url.path}/{ {self.primary_name} }'
f' with GET method not found')
redirect_url = self.get_post_redirect_get_url(response_model, sql_execute_result, fastapi_request)
await self.async_commit(session)
return RedirectResponse(redirect_url,
status_code=HTTPStatus.SEE_OTHER
)
def post_redirect_get(self, *, response_model, sql_execute_result, fastapi_request, **kwargs):
session = kwargs['session']
if not self.has_end_point(fastapi_request):
self.rollback(session)
raise FindOneApiNotRegister(404,
f'End Point {fastapi_request.url.path}/{ {self.primary_name} }'
f' with GET method not found')
redirect_url = self.get_post_redirect_get_url(response_model, sql_execute_result, fastapi_request)
self.commit(session)
return RedirectResponse(redirect_url,
status_code=HTTPStatus.SEE_OTHER
)
================================================
FILE: src/fastapi_quickcrud/misc/abstract_query.py
================================================
from abc import ABC
from typing import List, Union
from sqlalchemy import and_, select, text
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.sql.elements import BinaryExpression
from sqlalchemy.sql.schema import Table
from .exceptions import UnknownOrderType, UnknownColumn, UpdateColumnEmptyException
from .type import Ordering
from .utils import clean_input_fields, path_query_builder
from .utils import find_query_builder
class SQLAlchemyGeneralSQLQueryService(ABC):
def __init__(self, *, model, async_mode, foreign_table_mapping):
"""
:param model: declarative_base model
:param async_mode: bool
"""
self.model = model
self.model_columns = model
self.async_mode = async_mode
self.foreign_table_mapping = foreign_table_mapping
def get_many(self, *,
join_mode,
query,
target_model=None,
abstract_param=None
) -> BinaryExpression:
filter_args = query
limit = filter_args.pop('limit', None)
offset = filter_args.pop('offset', None)
order_by_columns = filter_args.pop('order_by_columns', None)
model = self.model
if target_model:
model = self.foreign_table_mapping[target_model]
filter_list: List[BinaryExpression] = find_query_builder(param=filter_args,
model=model)
path_filter_list: List[BinaryExpression] = path_query_builder(params=abstract_param,
model=self.foreign_table_mapping)
join_table_instance_list: list = self.get_join_select_fields(join_mode)
if not isinstance(self.model, Table):
model = model.__table__
stmt = select(*[model] + join_table_instance_list).filter(and_(*filter_list+path_filter_list))
if order_by_columns:
order_by_query_list = []
for order_by_column in order_by_columns:
if not order_by_column:
continue
sort_column, order_by = (order_by_column.replace(' ', '').split(':') + [None])[:2]
if not hasattr(self.model_columns, sort_column):
raise UnknownColumn(f'column {sort_column} is not exited')
if not order_by:
order_by_query_list.append(getattr(self.model_columns, sort_column).asc())
elif order_by.upper() == Ordering.DESC.upper():
order_by_query_list.append(getattr(self.model_columns, sort_column).desc())
elif order_by.upper() == Ordering.ASC.upper():
order_by_query_list.append(getattr(self.model_columns, sort_column).asc())
else:
raise UnknownOrderType(f"Unknown order type {order_by}, only accept DESC or ASC")
if order_by_query_list:
stmt = stmt.order_by(*order_by_query_list)
stmt = stmt.limit(limit).offset(offset)
stmt = self.get_join_by_excpression(stmt, join_mode=join_mode)
return stmt
def get_one(self, *,
extra_args: dict,
filter_args: dict,
join_mode=None
) -> BinaryExpression:
filter_list: List[BinaryExpression] = find_query_builder(param=filter_args,
model=self.model_columns)
extra_query_expression: List[BinaryExpression] = find_query_builder(param=extra_args,
model=self.model)
join_table_instance_list: list = self.get_join_select_fields(join_mode)
model = self.model
if not isinstance(self.model, Table):
model = model.__table__
stmt = select(*[model] + join_table_instance_list).where(and_(*filter_list + extra_query_expression))
# stmt = session.query(*[model] + join_table_instance_list).filter(and_(*filter_list + extra_query_expression))
stmt = self.get_join_by_excpression(stmt, join_mode=join_mode)
return stmt
def create(self, *,
insert_arg,
create_one=True,
) -> List[BinaryExpression]:
insert_arg_dict: Union[list, dict] = insert_arg
if not create_one:
insert_arg_list: list = insert_arg_dict.pop('insert', None)
insert_arg_dict = []
for i in insert_arg_list:
insert_arg_dict.append(i.__dict__)
if not isinstance(insert_arg_dict, list):
insert_arg_dict = [insert_arg_dict]
insert_arg_dict: list[dict] = [clean_input_fields(model=self.model_columns, param=insert_arg)
for insert_arg in insert_arg_dict]
if isinstance(insert_arg_dict, list):
new_data = []
for i in insert_arg_dict:
new_data.append(self.model(**i))
return new_data
def upsert(self, *,
insert_arg,
unique_fields: List[str],
upsert_one=True,
) -> BinaryExpression:
raise NotImplementedError
def insert_one(self, *,
insert_args) -> BinaryExpression:
insert_args = insert_args
update_columns = clean_input_fields(insert_args,
self.model_columns)
inserted_instance = self.model(**update_columns)
return inserted_instance
def get_join_select_fields(self, join_mode=None):
join_table_instance_list = []
if not join_mode:
return join_table_instance_list
for _, table_instance in join_mode.items():
for local_reference in table_instance['local_reference_pairs_set']:
if 'exclude' in local_reference and local_reference['exclude']:
continue
for column in local_reference['reference_table_columns']:
foreign_table_name = local_reference['reference']['reference_table']
join_table_instance_list.append(
column.label(foreign_table_name + '_foreign_____' + str(column).split('.')[1]))
return join_table_instance_list
def get_join_by_excpression(self, stmt: BinaryExpression, join_mode=None) -> BinaryExpression:
if not join_mode:
return stmt
for join_table, data in join_mode.items():
for local_reference in data['local_reference_pairs_set']:
local = local_reference['local']['local_column']
reference = local_reference['reference']['reference_column']
local_column = getattr(local_reference['local_table_columns'], local)
reference_column = getattr(local_reference['reference_table_columns'], reference)
table = local_reference['reference_table']
stmt = stmt.join(table, local_column == reference_column)
return stmt
# def delete(self,
# *,
# delete_args: dict,
# session,
# primary_key: dict = None,
# ) -> BinaryExpression:
# filter_list: List[BinaryExpression] = find_query_builder(param=delete_args,
# model=self.model_columns)
# if primary_key:
# filter_list += find_query_builder(param=primary_key,
# model=self.model_columns)
#
# delete_instance = session.query(self.model).where(and_(*filter_list))
# return delete_instance
def model_query(self,
*,
session,
extra_args: dict = None,
filter_args: dict = None,
) -> BinaryExpression:
'''
used for delette and update
'''
filter_list: List[BinaryExpression] = find_query_builder(param=filter_args,
model=self.model_columns)
if extra_args:
filter_list += find_query_builder(param=extra_args,
model=self.model_columns)
stmt = select(self.model).where(and_(*filter_list))
return stmt
def get_one_with_foreign_pk(self, *,
join_mode,
query,
target_model,
abstract_param=None
) -> BinaryExpression:
model = self.foreign_table_mapping[target_model]
filter_list: List[BinaryExpression] = find_query_builder(param=query,
model=model)
path_filter_list: List[BinaryExpression] = path_query_builder(params=abstract_param,
model=self.foreign_table_mapping)
join_table_instance_list: list = self.get_join_select_fields(join_mode)
if not isinstance(self.model, Table):
model = model.__table__
stmt = select(*[model] + join_table_instance_list).filter(and_(*filter_list + path_filter_list))
stmt = self.get_join_by_excpression(stmt, join_mode=join_mode)
return stmt
# def update(self, *,
# update_args,
# extra_query,
# session,
# primary_key=None,
# ) -> BinaryExpression:
#
#
# filter_list: List[BinaryExpression] = find_query_builder(param=extra_query,
# model=self.model_columns)
# if primary_key:
# primary_key = primary_key
# filter_list += find_query_builder(param=primary_key, model=self.model_columns)
# update_stmt = update(self.model).where(and_(*filter_list)).values(update_args)
# update_stmt = update_stmt.execution_options(synchronize_session=False)
# return update_stmt
class SQLAlchemyPGSQLQueryService(SQLAlchemyGeneralSQLQueryService):
def __init__(self, *, model, async_mode, foreign_table_mapping):
"""
:param model: declarative_base model
:param async_mode: bool
"""
super(SQLAlchemyPGSQLQueryService,
self).__init__(model=model,
async_mode=async_mode,
foreign_table_mapping=foreign_table_mapping)
self.model = model
self.model_columns = model
self.async_mode = async_mode
def upsert(self, *,
insert_arg,
unique_fields: List[str],
upsert_one=True,
) -> BinaryExpression:
insert_arg_dict: Union[list, dict] = insert_arg
insert_with_conflict_handle = insert_arg_dict.pop('on_conflict', None)
if not upsert_one:
insert_arg_list: list = insert_arg_dict.pop('insert', None)
insert_arg_dict = []
for i in insert_arg_list:
insert_arg_dict.append(i.__dict__)
if not isinstance(insert_arg_dict, list):
insert_arg_dict: list[dict] = [insert_arg_dict]
insert_arg_dict: list[dict] = [clean_input_fields(model=self.model_columns, param=insert_arg)
for insert_arg in insert_arg_dict]
insert_stmt = insert(self.model).values(insert_arg_dict)
if unique_fields and insert_with_conflict_handle:
update_columns = clean_input_fields(insert_with_conflict_handle.__dict__.get('update_columns', None),
self.model_columns)
if not update_columns:
raise UpdateColumnEmptyException('update_columns parameter must be a non-empty list ')
conflict_update_dict = {}
for columns in update_columns:
conflict_update_dict[columns] = getattr(insert_stmt.excluded, columns)
conflict_list = clean_input_fields(model=self.model_columns, param=unique_fields)
conflict_update_dict = clean_input_fields(model=self.model_columns, param=conflict_update_dict)
insert_stmt = insert_stmt.on_conflict_do_update(index_elements=conflict_list,
set_=conflict_update_dict
)
insert_stmt = insert_stmt.returning(text('*'))
return insert_stmt
class SQLAlchemySQLITEQueryService(SQLAlchemyGeneralSQLQueryService):
def __init__(self, *, model, async_mode, foreign_table_mapping):
"""
:param model: declarative_base model
:param async_mode: bool
"""
super().__init__(model=model,
async_mode=async_mode,
foreign_table_mapping=foreign_table_mapping)
self.model = model
self.model_columns = model
self.async_mode = async_mode
def upsert(self, *,
insert_arg,
unique_fields: List[str],
upsert_one=True,
) -> BinaryExpression:
raise NotImplementedError
class SQLAlchemyMySQLQueryService(SQLAlchemyGeneralSQLQueryService):
def __init__(self, *, model, async_mode, foreign_table_mapping):
"""
:param model: declarative_base model
:param async_mode: bool
"""
super().__init__(model=model,
async_mode=async_mode,
foreign_table_mapping=foreign_table_mapping)
self.model = model
self.model_columns = model
self.async_mode = async_mode
def upsert(self, *,
insert_arg,
unique_fields: List[str],
upsert_one=True,
) -> BinaryExpression:
raise NotImplementedError
class SQLAlchemyMariaDBQueryService(SQLAlchemyGeneralSQLQueryService):
def __init__(self, *, model, async_mode, foreign_table_mapping):
"""
:param model: declarative_base model
:param async_mode: bool
"""
super().__init__(model=model,
async_mode=async_mode,
foreign_table_mapping=foreign_table_mapping)
self.model = model
self.model_columns = model
self.async_mode = async_mode
def upsert(self, *,
insert_arg,
unique_fields: List[str],
upsert_one=True,
) -> BinaryExpression:
raise NotImplementedError
class SQLAlchemyOracleQueryService(SQLAlchemyGeneralSQLQueryService):
def __init__(self, *, model, async_mode, foreign_table_mapping):
"""
:param model: declarative_base model
:param async_mode: bool
"""
super().__init__(model=model,
async_mode=async_mode,
foreign_table_mapping=foreign_table_mapping)
self.model = model
self.model_columns = model
self.async_mode = async_mode
def upsert(self, *,
insert_arg,
unique_fields: List[str],
upsert_one=True,
) -> BinaryExpression:
raise NotImplementedError
class SQLAlchemyMSSqlQueryService(SQLAlchemyGeneralSQLQueryService):
def __init__(self, *, model, async_mode, foreign_table_mapping):
"""
:param model: declarative_base model
:param async_mode: bool
"""
super().__init__(model=model,
async_mode=async_mode,
foreign_table_mapping=foreign_table_mapping)
self.model = model
self.model_columns = model
self.async_mode = async_mode
def upsert(self, *,
insert_arg,
unique_fields: List[str],
upsert_one=True,
) -> BinaryExpression:
raise NotImplementedError
class SQLAlchemyNotSupportQueryService(SQLAlchemyGeneralSQLQueryService):
def __init__(self, *, model, async_mode, foreign_table_mapping):
"""
:param model: declarative_base model
:param async_mode: bool
"""
super().__init__(model=model,
async_mode=async_mode,
foreign_table_mapping=foreign_table_mapping)
self.model = model
self.model_columns = model
self.async_mode = async_mode
def upsert(self, *,
insert_arg,
unique_fields: List[str],
upsert_one=True,
) -> BinaryExpression:
raise NotImplementedError
================================================
FILE: src/fastapi_quickcrud/misc/abstract_route.py
================================================
from abc import abstractmethod, ABC
from http import HTTPStatus
from typing import Union
from fastapi import \
Depends, \
Response
from sqlalchemy.exc import IntegrityError
from starlette.requests import Request
class SQLAlchemyGeneralSQLBaseRouteSource(ABC):
""" This route will support the SQL SQLAlchemy dialects. """
@classmethod
def find_one(cls, api,
*,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
dependencies,
request_url_param_model,
request_query_model,
db_session):
if not async_mode:
@api.get(path, status_code=200, response_model=response_model, dependencies=dependencies)
def get_one_by_primary_key(response: Response,
request: Request,
url_param=Depends(request_url_param_model),
query=Depends(request_query_model),
session=Depends(db_session)):
join = query.__dict__.pop('join_foreign_table', None)
stmt = query_service.get_one(filter_args=query.__dict__,
extra_args=url_param.__dict__,
join_mode=join)
query_result = execute_service.execute(session, stmt)
response_result = parsing_service.find_one(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session,
join_mode=join)
return response_result
else:
@api.get(path, status_code=200, response_model=response_model, dependencies=dependencies)
async def async_get_one_by_primary_key(response: Response,
request: Request,
url_param=Depends(request_url_param_model),
query=Depends(request_query_model),
session=Depends(db_session)):
join = query.__dict__.pop('join_foreign_table', None)
stmt = query_service.get_one(filter_args=query.__dict__,
extra_args=url_param.__dict__,
join_mode=join)
query_result = await execute_service.async_execute(session, stmt)
response_result = await parsing_service.async_find_one(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session,
join_mode=join)
return response_result
@classmethod
def find_many(cls, api, *,
query_service,
parsing_service,
execute_service,
async_mode,
path,
response_model,
dependencies,
request_query_model,
db_session):
if async_mode:
@api.get(path, dependencies=dependencies, response_model=response_model)
async def async_get_many(response: Response,
request: Request,
query=Depends(request_query_model),
session=Depends(
db_session)
):
join = query.__dict__.pop('join_foreign_table', None)
stmt = query_service.get_many(query=query.__dict__, join_mode=join)
query_result = await execute_service.async_execute(session, stmt)
parsed_response = await parsing_service.async_find_many(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
join_mode=join,
session=session)
return parsed_response
else:
@api.get(path, dependencies=dependencies, response_model=response_model)
def get_many(response: Response,
request: Request,
query=Depends(request_query_model),
session=Depends(
db_session)
):
join = query.__dict__.pop('join_foreign_table', None)
stmt = query_service.get_many(query=query.__dict__, join_mode=join)
query_result = execute_service.execute(session, stmt)
parsed_response = parsing_service.find_many(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
join_mode=join,
session=session)
return parsed_response
@abstractmethod
def upsert_one(cls, api, *,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
request_body_model,
dependencies,
db_session,
unique_list):
raise NotImplementedError
@abstractmethod
def upsert_many(cls, api, *,
query_service,
parsing_service,
async_mode,
path,
response_model,
dependencies,
request_body_model,
db_session,
unique_list,
execute_service):
raise NotImplementedError
@classmethod
def create_one(cls, api, *,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
request_body_model,
dependencies,
db_session,
unique_list):
if async_mode:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
async def async_insert_one(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
# stmt = query_service.create(insert_arg=query)
new_inserted_data = query_service.create(insert_arg=query.__dict__)
execute_service.add_all(session, new_inserted_data)
try:
await execute_service.async_flush(session)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return await parsing_service.async_create_one(response_model=response_model,
sql_execute_result=new_inserted_data,
fastapi_response=response,
session=session)
else:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
def insert_one(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
new_inserted_data = query_service.create(insert_arg=query.__dict__)
execute_service.add_all(session, new_inserted_data)
try:
execute_service.flush(session)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return parsing_service.create_one(response_model=response_model,
sql_execute_result=new_inserted_data,
fastapi_response=response,
session=session)
@classmethod
def create_many(cls, api, *,
query_service,
parsing_service,
async_mode,
path,
response_model,
dependencies,
request_body_model,
db_session,
unique_list,
execute_service):
if async_mode:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
async def async_insert_many(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
inserted_data = query_service.create(insert_arg=query.__dict__,
create_one=False)
execute_service.add_all(session, inserted_data)
try:
await execute_service.async_flush(session)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return await parsing_service.async_create_many(response_model=response_model,
sql_execute_result=inserted_data,
fastapi_response=response,
session=session)
else:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
def insert_many(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
# inserted_data = query.__dict__['insert']
update_list = query.__dict__
inserted_data = query_service.create(insert_arg=update_list,
create_one=False)
execute_service.add_all(session, inserted_data)
try:
execute_service.flush(session)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return parsing_service.create_many(response_model=response_model,
sql_execute_result=inserted_data,
fastapi_response=response,
session=session)
@classmethod
def delete_one(cls, api, *,
query_service,
parsing_service,
execute_service,
async_mode,
path,
response_model,
dependencies,
request_query_model,
request_url_model,
db_session, ):
if async_mode:
@api.delete(path, status_code=200, response_model=response_model, dependencies=dependencies)
async def async_delete_one_by_primary_key(response: Response,
request: Request,
query=Depends(request_query_model),
request_url_param_model=Depends(request_url_model),
session=Depends(db_session)):
# delete_instance = query_service.model_query(
# filter_args=request_url_param_model.__dict__,
# extra_args=query.__dict__,
# session=session)
filter_stmt = query_service.model_query(filter_args=request_url_param_model.__dict__,
extra_args=query.__dict__,
session=session)
tmp = await session.execute(filter_stmt)
delete_instance = tmp.scalar()
return await parsing_service.async_delete_one(response_model=response_model,
sql_execute_result=delete_instance,
fastapi_response=response,
session=session)
else:
@api.delete(path, status_code=200, response_model=response_model, dependencies=dependencies)
def delete_one_by_primary_key(response: Response,
request: Request,
query=Depends(request_query_model),
request_url_param_model=Depends(request_url_model),
session=Depends(db_session)):
filter_stmt = query_service.model_query(filter_args=request_url_param_model.__dict__,
extra_args=query.__dict__,
session=session)
delete_instance = session.execute(filter_stmt).scalar()
return parsing_service.delete_one(response_model=response_model,
sql_execute_result=delete_instance,
fastapi_response=response,
session=session)
@classmethod
def delete_many(cls, api, *,
query_service,
parsing_service,
execute_service,
async_mode,
path,
response_model,
dependencies,
request_query_model,
db_session):
if async_mode:
@api.delete(path, status_code=200, response_model=response_model, dependencies=dependencies)
async def async_delete_many_by_query(response: Response,
request: Request,
query=Depends(request_query_model),
session=Depends(db_session)):
filter_stmt = query_service.model_query(filter_args=query.__dict__,
session=session)
tmp = await session.execute(filter_stmt)
data_instance = [i for i in tmp.scalars()]
return await parsing_service.async_delete_many(response_model=response_model,
sql_execute_results=data_instance,
fastapi_response=response,
session=session)
else:
@api.delete(path, status_code=200, response_model=response_model, dependencies=dependencies)
def delete_many_by_query(response: Response,
request: Request,
query=Depends(request_query_model),
session=Depends(db_session)):
filter_stmt = query_service.model_query(filter_args=query.__dict__,
session=session)
delete_instance = [i for i in session.execute(filter_stmt).scalars()]
return parsing_service.delete_many(response_model=response_model,
sql_execute_results=delete_instance,
fastapi_response=response,
session=session)
@classmethod
def post_redirect_get(cls, api, *,
dependencies,
request_body_model,
db_session,
crud_service,
result_parser,
execute_service,
async_mode,
response_model):
if async_mode:
@api.post("", status_code=303, response_class=Response, dependencies=dependencies)
async def async_create_one_and_redirect_to_get_one_api_with_primary_key(
request: Request,
insert_args: request_body_model = Depends(),
session=Depends(db_session),
):
new_inserted_data = crud_service.insert_one(insert_args=insert_args.__dict__)
execute_service.add(session, new_inserted_data)
try:
await execute_service.async_flush(session)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return await result_parser.async_post_redirect_get(response_model=response_model,
sql_execute_result=new_inserted_data,
fastapi_request=request,
session=session)
else:
@api.post("", status_code=303, response_class=Response, dependencies=dependencies)
def create_one_and_redirect_to_get_one_api_with_primary_key(
request: Request,
insert_args: request_body_model = Depends(),
session=Depends(db_session),
):
new_inserted_data = crud_service.insert_one(insert_args=insert_args.__dict__)
execute_service.add(session, new_inserted_data)
try:
execute_service.flush(session)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return result_parser.post_redirect_get(response_model=response_model,
sql_execute_result=new_inserted_data,
fastapi_request=request,
session=session)
@classmethod
def patch_one(cls, api, *,
path,
response_model,
dependencies,
request_url_param_model,
request_body_model,
request_query_model,
execute_service,
db_session,
crud_service,
result_parser,
async_mode):
if async_mode:
@api.patch(path,
status_code=200,
response_model=Union[response_model],
dependencies=dependencies)
async def async_partial_update_one_by_primary_key(
response: Response,
primary_key: request_url_param_model = Depends(),
patch_data: request_body_model = Depends(),
extra_query: request_query_model = Depends(),
session=Depends(db_session),
):
filter_stmt = crud_service.model_query(filter_args=primary_key.__dict__,
extra_args=extra_query.__dict__,
session=session)
data_instance = await session.execute(filter_stmt)
data_instance = data_instance.scalar()
try:
return await result_parser.async_update(response_model=response_model,
sql_execute_result=data_instance,
update_args=patch_data.__dict__,
fastapi_response=response,
session=session,
update_one=True)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
else:
@api.patch(path,
status_code=200,
response_model=Union[response_model],
dependencies=dependencies)
def partial_update_one_by_primary_key(
response: Response,
primary_key: request_url_param_model = Depends(),
patch_data: request_body_model = Depends(),
extra_query: request_query_model = Depends(),
session=Depends(db_session),
):
filter_stmt = crud_service.model_query(filter_args=primary_key.__dict__,
extra_args=extra_query.__dict__,
session=session)
update_instance = session.execute(filter_stmt).scalar()
try:
return result_parser.update(response_model=response_model,
sql_execute_result=update_instance,
update_args=patch_data.__dict__,
fastapi_response=response,
session=session,
update_one=True)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
@classmethod
def patch_many(cls, api, *,
path,
response_model,
dependencies,
request_body_model,
request_query_model,
db_session,
crud_service,
result_parser,
execute_service,
async_mode):
if async_mode:
@api.patch(path,
status_code=200,
response_model=response_model,
dependencies=dependencies)
async def async_partial_update_many_by_query(
response: Response,
patch_data: request_body_model = Depends(),
extra_query: request_query_model = Depends(),
session=Depends(db_session)
):
filter_stmt = crud_service.model_query(filter_args=extra_query.__dict__,
session=session)
tmp = await session.execute(filter_stmt)
data_instance = [i for i in tmp.scalars()]
if not data_instance:
return Response(status_code=HTTPStatus.NO_CONTENT)
try:
return await result_parser.async_update(response_model=response_model,
sql_execute_result=data_instance,
fastapi_response=response,
update_args=patch_data.__dict__,
session=session,
update_one=False)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
else:
@api.patch(path,
status_code=200,
response_model=response_model,
dependencies=dependencies)
def partial_update_many_by_query(
response: Response,
patch_data: request_body_model = Depends(),
extra_query: request_query_model = Depends(),
session=Depends(db_session)
):
filter_stmt = crud_service.model_query(filter_args=extra_query.__dict__,
session=session)
data_instance = [i for i in session.execute(filter_stmt).scalars()]
if not data_instance:
return Response(status_code=HTTPStatus.NO_CONTENT)
try:
return result_parser.update(response_model=response_model,
sql_execute_result=data_instance,
fastapi_response=response,
update_args=patch_data.__dict__,
session=session,
update_one=False)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
@classmethod
def put_one(cls, api, *,
path,
request_url_param_model,
request_body_model,
response_model,
dependencies,
request_query_model,
db_session,
crud_service,
result_parser,
execute_service,
async_mode):
if async_mode:
@api.put(path, status_code=200, response_model=response_model, dependencies=dependencies)
async def async_entire_update_by_primary_key(
response: Response,
primary_key: request_url_param_model = Depends(),
update_data: request_body_model = Depends(),
extra_query: request_query_model = Depends(),
session=Depends(db_session),
):
filter_stmt = crud_service.model_query(filter_args=primary_key.__dict__,
extra_args=extra_query.__dict__,
session=session)
data_instance = await session.execute(filter_stmt)
data_instance = data_instance.scalar()
if not data_instance:
return Response(status_code=HTTPStatus.NOT_FOUND)
try:
return await result_parser.async_update(response_model=response_model,
sql_execute_result=data_instance,
fastapi_response=response,
update_args=update_data.__dict__,
session=session,
update_one=True)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
else:
@api.put(path, status_code=200, response_model=response_model, dependencies=dependencies)
def entire_update_by_primary_key(
response: Response,
primary_key: request_url_param_model = Depends(),
update_data: request_body_model = Depends(),
extra_query: request_query_model = Depends(),
session=Depends(db_session),
):
filter_stmt = crud_service.model_query(filter_args=primary_key.__dict__,
extra_args=extra_query.__dict__,
session=session)
data_instance = session.execute(filter_stmt).scalar()
if not data_instance:
return Response(status_code=HTTPStatus.NOT_FOUND)
try:
return result_parser.update(response_model=response_model,
sql_execute_result=data_instance,
fastapi_response=response,
update_args=update_data.__dict__,
session=session,
update_one=True)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
@classmethod
def put_many(cls, api, *,
path,
response_model,
dependencies,
request_query_model,
request_body_model,
db_session,
crud_service,
result_parser,
execute_service,
async_mode):
if async_mode:
@api.put(path, status_code=200, response_model=response_model, dependencies=dependencies)
async def async_entire_update_many_by_query(
response: Response,
update_data: request_body_model = Depends(),
extra_query: request_query_model = Depends(),
session=Depends(db_session),
):
filter_stmt = crud_service.model_query(filter_args=extra_query.__dict__,
session=session)
tmp = await session.execute(filter_stmt)
data_instance = [i for i in tmp.scalars()]
if not data_instance:
return Response(status_code=HTTPStatus.NO_CONTENT)
try:
return await result_parser.async_update(response_model=response_model,
sql_execute_result=data_instance,
fastapi_response=response,
update_args=update_data.__dict__,
session=session,
update_one=False)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
else:
@api.put(path, status_code=200, response_model=response_model, dependencies=dependencies)
def entire_update_many_by_query(
response: Response,
update_data: request_body_model = Depends(),
extra_query: request_query_model = Depends(),
session=Depends(db_session),
):
filter_stmt = crud_service.model_query(filter_args=extra_query.__dict__,
session=session)
data_instance = [i for i in session.execute(filter_stmt).scalars()]
if not data_instance:
return Response(status_code=HTTPStatus.NO_CONTENT)
try:
return result_parser.update(response_model=response_model,
sql_execute_result=data_instance,
fastapi_response=response,
update_args=update_data.__dict__,
session=session,
update_one=False)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
# return result_parser.update_many(response_model=response_model,
# sql_execute_result=query_result,
# fastapi_response=response,
# session=session)
@classmethod
def find_one_foreign_tree(cls, api, *,
query_service,
parsing_service,
execute_service,
async_mode,
path,
response_model,
dependencies,
request_query_model,
request_url_param_model,
function_name,
db_session):
if async_mode:
@api.get(path, dependencies=dependencies, response_model=response_model, name=function_name)
async def async_get_one_with_foreign_tree(response: Response,
request: Request,
url_param=Depends(request_url_param_model),
query=Depends(request_query_model),
session=Depends(
db_session)
):
target_model = request.url.path.split("/")[-2]
join = query.__dict__.pop('join_foreign_table', None)
stmt = query_service.get_one_with_foreign_pk(query=query.__dict__,
join_mode=join,
abstract_param=url_param.__dict__,
target_model=target_model)
query_result = await execute_service.async_execute(session, stmt)
parsed_response = await parsing_service.async_find_one(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
join_mode=join,
session=session)
return parsed_response
else:
@api.get(path, dependencies=dependencies, response_model=response_model, name=function_name)
def get_one_with_foreign_tree(response: Response,
request: Request,
url_param=Depends(request_url_param_model),
query=Depends(request_query_model),
session=Depends(
db_session)
):
target_model = request.url.path.split("/")[-2]
join = query.__dict__.pop('join_foreign_table', None)
stmt = query_service.get_one_with_foreign_pk(query=query.__dict__,
join_mode=join,
abstract_param=url_param.__dict__,
target_model=target_model)
query_result = execute_service.execute(session, stmt)
parsed_response = parsing_service.find_one(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
join_mode=join,
session=session)
return parsed_response
@classmethod
def find_many_foreign_tree(cls, api, *,
query_service,
parsing_service,
execute_service,
async_mode,
path,
response_model,
dependencies,
request_query_model,
request_url_param_model,
function_name,
db_session):
if async_mode:
@api.get(path, dependencies=dependencies, response_model=response_model, name=function_name)
async def async_get_many_with_foreign_tree(response: Response,
request: Request,
url_param=Depends(request_url_param_model),
query=Depends(request_query_model),
session=Depends(
db_session)
):
target_model = request.url.path.split("/")[-1]
join = query.__dict__.pop('join_foreign_table', None)
stmt = query_service.get_many(query=query.__dict__, join_mode=join, abstract_param=url_param.__dict__,
target_model=target_model)
query_result = await execute_service.async_execute(session, stmt)
parsed_response = await parsing_service.async_find_many(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
join_mode=join,
session=session)
return parsed_response
else:
@api.get(path, dependencies=dependencies, response_model=response_model, name=function_name)
def get_many_with_foreign_tree(response: Response,
request: Request,
url_param=Depends(request_url_param_model),
query=Depends(request_query_model),
session=Depends(
db_session)
):
target_model = request.url.path.split("/")[-1]
join = query.__dict__.pop('join_foreign_table', None)
stmt = query_service.get_many(query=query.__dict__, join_mode=join, abstract_param=url_param.__dict__,
target_model=target_model)
query_result = execute_service.execute(session, stmt)
parsed_response = parsing_service.find_many(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
join_mode=join,
session=session)
return parsed_response
class SQLAlchemyPGSQLRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
'''
This route will support the SQL SQLAlchemy dialects
'''
@classmethod
def upsert_one(cls, api, *,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
request_body_model,
dependencies,
db_session,
unique_list):
if async_mode:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
async def async_insert_one_and_support_upsert(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
stmt = query_service.upsert(insert_arg=query.__dict__,
unique_fields=unique_list)
try:
query_result = await execute_service.async_execute(session, stmt)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT, content=err_msg)
return result
return await parsing_service.async_upsert_one(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session)
else:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
def insert_one_and_support_upsert(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
stmt = query_service.upsert(insert_arg=query.__dict__,
unique_fields=unique_list)
try:
query_result = execute_service.execute(session, stmt)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT, content=err_msg)
return result
return parsing_service.upsert_one(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session)
@classmethod
def upsert_many(cls, api, *,
query_service,
parsing_service,
async_mode,
path,
response_model,
dependencies,
request_body_model,
db_session,
unique_list,
execute_service):
if async_mode:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
async def async_insert_many_and_support_upsert(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
stmt = query_service.upsert(insert_arg=query.__dict__,
unique_fields=unique_list,
upsert_one=False)
try:
query_result = await execute_service.async_execute(session, stmt)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT, content=err_msg)
return result
return await parsing_service.async_upsert_many(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session)
else:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
def insert_many_and_support_upsert(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
stmt = query_service.upsert(insert_arg=query.__dict__,
unique_fields=unique_list,
upsert_one=False)
try:
query_result = execute_service.execute(session, stmt)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT, content=err_msg)
return result
return parsing_service.upsert_many(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session)
class SQLAlchemySQLLiteRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
'''
This route will support the SQL SQLAlchemy dialects
'''
@classmethod
def upsert_one(cls, api, *,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
request_body_model,
dependencies,
db_session,
unique_list):
if async_mode:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
async def async_insert_one_and_support_upsert(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
stmt = query_service.upsert(insert_arg=query.__dict__,
unique_fields=unique_list)
try:
query_result = await execute_service.async_execute(session, stmt)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return await parsing_service.async_upsert_one(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session)
else:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
def insert_one_and_support_upsert(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
stmt = query_service.upsert(insert_arg=query.__dict__,
unique_fields=unique_list)
try:
query_result = execute_service.execute(session, stmt)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return parsing_service.upsert_one(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session)
@classmethod
def upsert_many(cls, api, *,
query_service,
parsing_service,
async_mode,
path,
response_model,
dependencies,
request_body_model,
db_session,
unique_list,
execute_service):
if async_mode:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
async def async_insert_many_and_support_upsert(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
stmt = query_service.upsert(insert_arg=query.__dict__,
unique_fields=unique_list,
upsert_one=False)
try:
query_result = await execute_service.async_execute(session, stmt)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return await parsing_service.async_upsert_many(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session)
else:
@api.post(path, status_code=201, response_model=response_model, dependencies=dependencies)
def insert_many_and_support_upsert(
response: Response,
request: Request,
query: request_body_model = Depends(request_body_model),
session=Depends(db_session)
):
stmt = query_service.upsert(insert_arg=query.__dict__,
unique_fields=unique_list,
upsert_one=False)
try:
query_result = execute_service.execute(session, stmt)
except IntegrityError as e:
err_msg, = e.orig.args
if 'unique constraint' not in err_msg.lower():
raise e
result = Response(status_code=HTTPStatus.CONFLICT)
return result
return parsing_service.upsert_many(response_model=response_model,
sql_execute_result=query_result,
fastapi_response=response,
session=session)
class SQLAlchemyMySQLRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
'''
This route will support the SQL SQLAlchemy dialects
'''
@classmethod
def upsert_one(cls, api, *,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
request_body_model,
dependencies,
db_session,
unique_list):
raise NotImplementedError
@classmethod
def upsert_many(cls, api, *,
query_service,
parsing_service,
async_mode,
path,
response_model,
dependencies,
request_body_model,
db_session,
unique_list,
execute_service):
raise NotImplementedError
class SQLAlchemyMariadbRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
'''
This route will support the SQL SQLAlchemy dialects
'''
@classmethod
def upsert_one(cls, api, *,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
request_body_model,
dependencies,
db_session,
unique_list):
raise NotImplementedError
@classmethod
def upsert_many(cls, api, *,
query_service,
parsing_service,
async_mode,
path,
response_model,
dependencies,
request_body_model,
db_session,
unique_list,
execute_service):
raise NotImplementedError
class SQLAlchemyOracleRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
'''
This route will support the SQL SQLAlchemy dialects
'''
@classmethod
def upsert_one(cls, api, *,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
request_body_model,
dependencies,
db_session,
unique_list):
raise NotImplementedError
@classmethod
def upsert_many(cls, api, *,
query_service,
parsing_service,
async_mode,
path,
response_model,
dependencies,
request_body_model,
db_session,
unique_list,
execute_service):
raise NotImplementedError
class SQLAlchemyMSSQLRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
'''
This route will support the SQL SQLAlchemy dialects
'''
@classmethod
def upsert_one(cls, api, *,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
request_body_model,
dependencies,
db_session,
unique_list):
raise NotImplementedError
@classmethod
def upsert_many(cls, api, *,
query_service,
parsing_service,
async_mode,
path,
response_model,
dependencies,
request_body_model,
db_session,
unique_list,
execute_service):
raise NotImplementedError
class SQLAlchemyNotSupportRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
'''
This route will support the SQL SQLAlchemy dialects
'''
@classmethod
def upsert_one(cls, api, *,
path,
query_service,
parsing_service,
execute_service,
async_mode,
response_model,
request_body_model,
dependencies,
db_session,
unique_list):
raise NotImplementedError
@classmethod
def upsert_many(cls, api, *,
query_service,
parsing_service,
async_mode,
path,
response_model,
dependencies,
request_body_model,
db_session,
unique_list,
execute_service):
raise NotImplementedError
================================================
FILE: src/fastapi_quickcrud/misc/covert_model.py
================================================
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql.schema import Table
def convert_table_to_model(db_model):
NO_PRIMARY_KEY = False
if not isinstance(db_model, Table):
return db_model, NO_PRIMARY_KEY
db_name = str(db_model.fullname)
table_dict = {'__table__': db_model,
'__tablename__': db_name}
if not db_model.primary_key:
table_dict['__mapper_args__'] = {
"primary_key": [i for i in db_model._columns]
}
NO_PRIMARY_KEY = True
for i in db_model.c:
col, = i.expression.base_columns
table_dict[str(i.key)] = col
return type(f'{db_name}DeclarativeBaseClass', (declarative_base(),), table_dict), NO_PRIMARY_KEY
================================================
FILE: src/fastapi_quickcrud/misc/crud_model.py
================================================
from typing import (Optional,
Dict,
List)
from pydantic import BaseModel
from pydantic.main import ModelMetaclass
from .exceptions import (RequestMissing,
InvalidRequestMethod)
from .type import CrudMethods
class RequestResponseModel(BaseModel):
requestUrlParamModel: Optional[ModelMetaclass]
requestRelationshipUrlParamField: Optional[List[str]]
requestQueryModel: Optional[ModelMetaclass]
requestBodyModel: Optional[ModelMetaclass]
responseModel: Optional[ModelMetaclass]
jsonRequestFieldModel: Optional[ModelMetaclass]
jsonbRequestFieldModel: Optional[ModelMetaclass]
arrayRequestFieldModel: Optional[ModelMetaclass]
foreignListModel: Optional[List[dict]]
class CRUDModel(BaseModel):
GET: Optional[Dict[CrudMethods, RequestResponseModel]]
POST: Optional[Dict[CrudMethods, RequestResponseModel]]
PUT: Optional[Dict[CrudMethods, RequestResponseModel]]
PATCH: Optional[Dict[CrudMethods, RequestResponseModel]]
DELETE: Optional[Dict[CrudMethods, RequestResponseModel]]
FIND_MANY_WITH_FOREIGN_TREE: Optional[Dict[CrudMethods, RequestResponseModel]]
PRIMARY_KEY_NAME: Optional[str]
UNIQUE_LIST: Optional[List[str]]
def get_available_request_method(self):
return [i for i in self.dict(exclude_unset=True, ).keys() if i in ["GET", "POST", "PUT", "PATCH", "DELETE"]]
def get_model_by_request_method(self, request_method):
available_methods = self.dict()
if request_method not in available_methods.keys():
raise InvalidRequestMethod(f'{request_method} is not an available request method')
if not available_methods[request_method]:
raise RequestMissing(
f'{request_method} is not available, '
f'make sure the CRUDModel contains this request method')
_ = available_methods[request_method]
return _
================================================
FILE: src/fastapi_quickcrud/misc/exceptions.py
================================================
from fastapi import HTTPException
class FindOneApiNotRegister(HTTPException):
pass
class CRUDBuilderException(BaseException):
pass
class RequestMissing(CRUDBuilderException):
pass
class PrimaryMissing(CRUDBuilderException):
pass
class UnknownOrderType(CRUDBuilderException):
pass
class UpdateColumnEmptyException(CRUDBuilderException):
pass
class UnknownColumn(CRUDBuilderException):
pass
class QueryOperatorNotFound(CRUDBuilderException):
pass
class UnknownError(CRUDBuilderException):
pass
class ConflictColumnsCannotHit(CRUDBuilderException):
pass
class MultipleSingleUniqueNotSupportedException(CRUDBuilderException):
pass
class SchemaException(CRUDBuilderException):
pass
class CompositePrimaryKeyConstraintNotSupportedException(CRUDBuilderException):
pass
class MultiplePrimaryKeyNotSupportedException(CRUDBuilderException):
pass
class ColumnTypeNotSupportedException(CRUDBuilderException):
pass
class InvalidRequestMethod(CRUDBuilderException):
pass
#
# class NotFoundError(MongoQueryError):
# def __init__(self, Collection: Type[ModelType], model: BaseModel):
# detail = "does not exist"
# super().__init__(Collection, model, detail)
#
#
#
# class DuplicatedError(MongoQueryError):
# def __init__(self, Collection: Type[ModelType], model: BaseModel):
# detail = "was already existed"
# super().__init__(Collection, model, detail)
class FDDRestHTTPException(HTTPException):
"""Baseclass for all HTTP exceptions in FDD Rest API. This exception can be called as WSGI
application to render a default error page or you can catch the subclasses
of it independently and render nicer error messages.
"""
================================================
FILE: src/fastapi_quickcrud/misc/memory_sql.py
================================================
import asyncio
import string
import random
from typing import Generator
from sqlalchemy import create_engine
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from sqlalchemy.orm import declarative_base, sessionmaker
from sqlalchemy.pool import StaticPool
class MemorySql():
def __init__(self, async_mode: bool = False):
"""
@type async_mode: bool
used to build sync or async memory sql connection
"""
self.async_mode = async_mode
SQLALCHEMY_DATABASE_URL = f"sqlite{'+aiosqlite' if async_mode else ''}://"
if not async_mode:
self.engine = create_engine(SQLALCHEMY_DATABASE_URL,
future=True,
echo=True,
pool_pre_ping=True,
pool_recycle=7200,
connect_args={"check_same_thread": False},
poolclass=StaticPool)
self.sync_session = sessionmaker(bind=self.engine,
autocommit=False, )
else:
self.engine = create_async_engine(SQLALCHEMY_DATABASE_URL,
future=True,
echo=True,
pool_pre_ping=True,
pool_recycle=7200,
connect_args={"check_same_thread": False},
poolclass=StaticPool)
self.sync_session = sessionmaker(autocommit=False,
autoflush=False,
bind=self.engine,
class_=AsyncSession)
def create_memory_table(self, Mode: 'declarative_base()'):
if not self.async_mode:
Mode.__table__.create(self.engine, checkfirst=True)
else:
async def create_table(engine, model):
async with engine.begin() as conn:
await conn.run_sync(model._sa_registry.metadata.create_all)
loop = asyncio.get_event_loop()
loop.run_until_complete(create_table(self.engine, Mode))
def get_memory_db_session(self) -> Generator:
try:
db = self.sync_session()
yield db
except Exception as e:
db.rollback()
raise e
finally:
db.close()
async def async_get_memory_db_session(self):
async with self.sync_session() as session:
yield session
async_memory_db = MemorySql(True)
sync_memory_db = MemorySql()
================================================
FILE: src/fastapi_quickcrud/misc/schema_builder.py
================================================
import uuid
import warnings
from copy import deepcopy
from dataclasses import (make_dataclass,
field)
from enum import auto
from typing import (Optional,
Any)
from typing import (Type,
Dict,
List,
Tuple,
TypeVar,
NewType,
Union)
import pydantic
from fastapi import (Body,
Query)
from pydantic import (BaseModel,
create_model,
BaseConfig)
from pydantic.dataclasses import dataclass as pydantic_dataclass
from sqlalchemy import UniqueConstraint, Table, Column
from sqlalchemy import inspect
from sqlalchemy.orm import DeclarativeMeta
from sqlalchemy.orm import declarative_base
from strenum import StrEnum
from .covert_model import convert_table_to_model
from .exceptions import (SchemaException,
ColumnTypeNotSupportedException)
from .type import (MatchingPatternInStringBase,
RangeFromComparisonOperators,
Ordering,
RangeToComparisonOperators,
ExtraFieldTypePrefix,
ExtraFieldType,
ItemComparisonOperators, PGSQLMatchingPatternInString, SqlType, )
FOREIGN_PATH_PARAM_KEYWORD = "__pk__"
BaseModelT = TypeVar('BaseModelT', bound=BaseModel)
DataClassT = TypeVar('DataClassT', bound=Any)
DeclarativeClassT = NewType('DeclarativeClassT', declarative_base)
TableNameT = NewType('TableNameT', str)
ResponseModelT = NewType('ResponseModelT', BaseModel)
ForeignKeyName = NewType('ForeignKeyName', str)
TableInstance = NewType('TableInstance', Table)
class ExcludeUnsetBaseModel(BaseModel):
def dict(self, *args, **kwargs):
if kwargs and kwargs.get("exclude_none") is not None:
kwargs["exclude_unset"] = True
return BaseModel.dict(self, *args, **kwargs)
class OrmConfig(BaseConfig):
orm_mode = True
def _add_orm_model_config_into_pydantic_model(pydantic_model, **kwargs) -> BaseModelT:
validators = kwargs.get('validators', None)
config = kwargs.get('config', None)
field_definitions = {
name_: (field_.outer_type_, field_.field_info.default)
for name_, field_ in pydantic_model.__fields__.items()
}
return create_model(f'{pydantic_model.__name__}WithValidators',
**field_definitions,
__config__=config,
__validators__=validators)
# def _add_validators(model: Type[BaseModelT], validators, **kwargs) -> Type[BaseModelT]:
# """
# Create a new BaseModel with the exact same fields as `model`
# but making them all optional and no default
# """
#
# config = kwargs.get('config', None)
#
# field_definitions = {
# name_: (field_.outer_type_, field_.field_info.default)
# for name_, field_ in model.__fields__.items()
# }
# return create_model(f'{model.__name__}WithValidators',
# **field_definitions,
# __config__=config,
# __validators__={**validators})
def _model_from_dataclass(kls: DataClassT) -> Type[BaseModel]:
""" Converts a stdlib dataclass to a pydantic BaseModel. """
return pydantic_dataclass(kls).__pydantic_model__
def _to_require_but_default(model: Type[BaseModelT]) -> Type[BaseModelT]:
"""
Create a new BaseModel with the exact same fields as `model`
but making them all require but there are default value
"""
config = model.Config
field_definitions = {}
for name_, field_ in model.__fields__.items():
field_definitions[name_] = (field_.outer_type_, field_.field_info.default)
return create_model(f'{model.__name__}RequireButDefault', **field_definitions,
__config__=config) # type: ignore[arg-type]
def _filter_none(request_or_response_object):
received_request = deepcopy(request_or_response_object.__dict__)
if 'insert' in received_request:
insert_item_without_null = []
for received_insert in received_request['insert']:
received_insert_ = deepcopy(received_insert)
for received_insert_item, received_insert_value in received_insert_.__dict__.items():
if hasattr(received_insert_value, '__module__'):
if received_insert_value.__module__ == 'fastapi.params' or received_insert_value is None:
delattr(received_insert, received_insert_item)
elif received_insert_value is None:
delattr(received_insert, received_insert_item)
insert_item_without_null.append(received_insert)
setattr(request_or_response_object, 'insert', insert_item_without_null)
else:
for name, value in received_request.items():
if hasattr(value, '__module__'):
if value.__module__ == 'fastapi.params' or value is None:
delattr(request_or_response_object, name)
elif value is None:
delattr(request_or_response_object, name)
class ApiParameterSchemaBuilder:
unsupported_data_types = ["BLOB"]
partial_supported_data_types = ["INTERVAL", "JSON", "JSONB"]
def __init__(self, db_model: Type, sql_type, exclude_column=None, constraints=None, exclude_primary_key=False,
foreign_include=False):
self.constraints = constraints
self.exclude_primary_key = exclude_primary_key
if exclude_column is None:
self._exclude_column = []
else:
self._exclude_column = exclude_column
self.alias_mapper: Dict[str, str] = {} # Table not support alias
if self.exclude_primary_key:
self.__db_model: Table = db_model
self.__db_model_table: Table = db_model.__table__
self.__columns = db_model.__table__.c
self.db_name: str = db_model.__tablename__
else:
self.__db_model: DeclarativeClassT = db_model
self.__db_model_table: Table = db_model.__table__
self.db_name: str = db_model.__tablename__
self.__columns = db_model.__table__.c
model = self.__db_model
self.primary_key_str, self._primary_key_dataclass_model, self._primary_key_field_definition \
= self._extract_primary()
self.unique_fields: List[str] = self._extract_unique()
self.uuid_type_columns = []
self.str_type_columns = []
self.number_type_columns = []
self.datetime_type_columns = []
self.timedelta_type_columns = []
self.bool_type_columns = []
self.json_type_columns = []
self.array_type_columns = []
self.foreign_table_response_model_sets: Dict[TableNameT, ResponseModelT] = {}
self.all_field: List[dict] = self._extract_all_field()
self.sql_type = sql_type
if not foreign_include:
foreign_include = []
self.foreign_include = foreign_include
self.foreign_mapper = self.__foreign_mapper_builder()
self.relation_level = self._extra_relation_level()
self.table_of_foreign, self.reference_mapper = self.extra_foreign_table()
def __foreign_mapper_builder(self):
foreign_mapper = {}
if self.exclude_primary_key:
return foreign_mapper
for db_model in self.foreign_include:
db_model, NO_PRIMARY_KEY = convert_table_to_model(db_model)
tmp = {}
table_name = self.__get_table_name(db_model)
tmp["model"] = db_model
foreign_mapper[table_name] = db_model
tmp["db_model"] = db_model
tmp["db_model_table"] = db_model.__table__
tmp["db_name"] = db_model.__t
gitextract_k7u649z0/
├── .coveragerc
├── .github/
│ └── workflows/
│ ├── ci.yml
│ ├── coverage.yml
│ └── release.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── README_zh.md
├── __init__.py
├── __main__.py
├── setup.py
├── src/
│ ├── __init__.py
│ └── fastapi_quickcrud/
│ ├── __init__.py
│ ├── crud_router.py
│ └── misc/
│ ├── __init__.py
│ ├── abstract_execute.py
│ ├── abstract_parser.py
│ ├── abstract_query.py
│ ├── abstract_route.py
│ ├── covert_model.py
│ ├── crud_model.py
│ ├── exceptions.py
│ ├── memory_sql.py
│ ├── schema_builder.py
│ ├── type.py
│ └── utils.py
├── tests/
│ ├── __init__.py
│ ├── conf/
│ │ ├── __init__.py
│ │ ├── config.py
│ │ ├── dev.docker-compose.yml
│ │ └── dev.env
│ └── test_implementations/
│ ├── __init__.py
│ ├── other/
│ │ └── __init__.py
│ ├── test_memory_sqlalchemy/
│ │ ├── __init__.py
│ │ ├── api_async_test/
│ │ │ ├── __init__.py
│ │ │ ├── foreign_tree/
│ │ │ │ ├── __init__.py
│ │ │ │ └── test_relationship_m2m.py
│ │ │ ├── test_create_many_api.py
│ │ │ ├── test_create_one_api.py
│ │ │ ├── test_delete_many_api.py
│ │ │ ├── test_delete_one_api.py
│ │ │ ├── test_get_many_api.py
│ │ │ ├── test_get_one_api.py
│ │ │ ├── test_other_default_value.py
│ │ │ ├── test_other_set_description.py
│ │ │ ├── test_other_single_unique.py
│ │ │ ├── test_patch_many_api.py
│ │ │ ├── test_patch_one_api.py
│ │ │ ├── test_post_redirect_get_api.py
│ │ │ ├── test_put_many_api.py
│ │ │ └── test_put_one_api.py
│ │ ├── api_test/
│ │ │ ├── __init__.py
│ │ │ ├── foreign_tree/
│ │ │ │ ├── __init__.py
│ │ │ │ └── test_relationship_m2m.py
│ │ │ ├── join_relationship/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── test_relationship_extra.py
│ │ │ │ ├── test_relationship_m2m.py
│ │ │ │ ├── test_relationship_m2m_back_populates.py
│ │ │ │ ├── test_relationship_m2o.py
│ │ │ │ ├── test_relationship_m2o_back_populates.py
│ │ │ │ ├── test_relationship_m2o_back_refer.py
│ │ │ │ ├── test_relationship_o2m.py
│ │ │ │ ├── test_relationship_o2m_back_populates.py
│ │ │ │ ├── test_relationship_o2m_back_ref.py
│ │ │ │ └── test_relationship_o2o.py
│ │ │ ├── test_create_many_api.py
│ │ │ ├── test_create_one_api.py
│ │ │ ├── test_delete_many_api.py
│ │ │ ├── test_delete_one_api.py
│ │ │ ├── test_get_many_api.py
│ │ │ ├── test_get_one_api.py
│ │ │ ├── test_other_default_value.py
│ │ │ ├── test_other_set_description.py
│ │ │ ├── test_other_single_unique.py
│ │ │ ├── test_patch_many_api.py
│ │ │ ├── test_patch_one_api.py
│ │ │ ├── test_post_redirect_get_api.py
│ │ │ ├── test_put_many_api.py
│ │ │ └── test_put_one_api.py
│ │ └── error_test/
│ │ ├── __init__.py
│ │ ├── test_create_null_type.py
│ │ ├── test_create_specific_api_when_no_pk.py
│ │ ├── test_create_table_with_more_than_one_unique_but_no_use_composite.py
│ │ ├── test_use_blob_type_column.py
│ │ ├── test_use_composite_primary.py
│ │ ├── test_use_more_than_one_pk.py
│ │ ├── test_use_more_than_one_unique.py
│ │ ├── test_use_unique_and_composite_unique.py
│ │ ├── test_use_unsupported_type_pk.py
│ │ ├── test_use_unsupported_type_pk_2.py
│ │ ├── test_use_unsupported_type_pk_3.py
│ │ └── test_use_unsupported_type_pk_4.py
│ ├── test_sqlalchemy/
│ │ ├── __init__.py
│ │ ├── api_test/
│ │ │ ├── __init__.py
│ │ │ ├── join_relationship/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── test_relationship_m2m.py
│ │ │ │ ├── test_relationship_m2m_back_populates.py
│ │ │ │ ├── test_relationship_m2o.py
│ │ │ │ ├── test_relationship_m2o_back_populates.py
│ │ │ │ ├── test_relationship_m2o_back_refer.py
│ │ │ │ ├── test_relationship_o2m.py
│ │ │ │ ├── test_relationship_o2m_back_populates.py
│ │ │ │ ├── test_relationship_o2m_back_ref.py
│ │ │ │ └── test_relationship_o2o.py
│ │ │ ├── test_create_many_api.py
│ │ │ ├── test_create_one_api.py
│ │ │ ├── test_delete_many_api.py
│ │ │ ├── test_delete_one_api.py
│ │ │ ├── test_get_many_api.py
│ │ │ ├── test_get_one_api.py
│ │ │ ├── test_other_default_value.py
│ │ │ ├── test_other_set_description.py
│ │ │ ├── test_other_single_unique.py
│ │ │ ├── test_other_uuid_primary.py
│ │ │ ├── test_patch_many_api.py
│ │ │ ├── test_patch_one_api.py
│ │ │ ├── test_post_redirect_get_api.py
│ │ │ ├── test_put_many_api.py
│ │ │ └── test_put_one_api.py
│ │ ├── api_test_async/
│ │ │ ├── __init__.py
│ │ │ ├── test_create_many_api.py
│ │ │ ├── test_create_one_api.py
│ │ │ ├── test_delete_many_api.py
│ │ │ ├── test_delete_one_api.py
│ │ │ ├── test_get_many_api.py
│ │ │ ├── test_get_one_api.py
│ │ │ ├── test_other_default_value.py
│ │ │ ├── test_other_single_unique.py
│ │ │ ├── test_other_uuid_primary.py
│ │ │ ├── test_patch_many_api.py
│ │ │ ├── test_patch_one_api.py
│ │ │ ├── test_post_redirect_get_api.py
│ │ │ ├── test_put_many_api.py
│ │ │ └── test_put_one_api.py
│ │ └── error_test/
│ │ ├── __init__.py
│ │ ├── test_create_null_type.py
│ │ ├── test_create_specific_api_when_no_pk.py
│ │ ├── test_create_table_with_more_than_one_unique_but_no_use_composite.py
│ │ ├── test_use_blob_type_column.py
│ │ ├── test_use_composite_primary.py
│ │ ├── test_use_more_than_one_pk.py
│ │ ├── test_use_more_than_one_unique.py
│ │ ├── test_use_unique_and_composite_unique.py
│ │ ├── test_use_unsupported_type_pk.py
│ │ ├── test_use_unsupported_type_pk_2.py
│ │ ├── test_use_unsupported_type_pk_3.py
│ │ └── test_use_unsupported_type_pk_4.py
│ └── test_sqlalchemy_table/
│ ├── __init__.py
│ ├── api_test/
│ │ ├── __init__.py
│ │ ├── test_delete_many_api.py
│ │ ├── test_delete_one_api.py
│ │ ├── test_get_many_api.py
│ │ ├── test_get_one_api.py
│ │ ├── test_other_no_alias.py
│ │ ├── test_other_set_description.py
│ │ ├── test_other_single_unique.py
│ │ ├── test_other_user_default_value.py
│ │ ├── test_other_uuid_primary.py
│ │ ├── test_patch_many_api.py
│ │ ├── test_patch_one_api.py
│ │ ├── test_post_redirect_get_api.py
│ │ ├── test_put_many_api.py
│ │ ├── test_put_one_api.py
│ │ ├── test_upsert_many_api.py
│ │ └── test_upsert_one_api.py
│ ├── api_test_async/
│ │ ├── __init__.py
│ │ ├── test_create_many_api.py
│ │ ├── test_create_one_api.py
│ │ ├── test_delete_many_api.py
│ │ ├── test_delete_one_api.py
│ │ ├── test_get_many_api.py
│ │ ├── test_get_one_api.py
│ │ ├── test_other_default_value.py
│ │ ├── test_other_no_alias.py
│ │ ├── test_other_single_unique.py
│ │ ├── test_other_uuid_primary.py
│ │ ├── test_patch_many_api.py
│ │ ├── test_patch_one_api.py
│ │ ├── test_post_redirect_get_api.py
│ │ ├── test_put_many_api.py
│ │ └── test_put_one_api.py
│ └── error_test/
│ ├── __init__.py
│ ├── test_create_null_type.py
│ ├── test_pk_no_default_value.py
│ ├── test_use_composite_primary.py
│ ├── test_use_more_than_one_pk.py
│ ├── test_use_more_than_one_unique.py
│ ├── test_use_unique_and_composite_unique.py
│ ├── test_use_unsupported_type.py
│ ├── test_use_unsupported_type_2.py
│ ├── test_use_unsupported_type_3.py
│ └── test_use_unsupported_type_4.py
└── tutorial/
├── __init__.py
├── basic_usage/
│ ├── __init__.py
│ ├── depencies_example_auth.py
│ ├── quick_usage_with_async_SQLALchemy_Base.py
│ ├── quick_usage_with_async_SQLALchemy_table.py
│ ├── quick_usage_with_async_SQLALchemy_table_with_out_primary_key.py
│ └── quick_usage_with_sync_SQLAlchemy_Base.py
├── foreign_tree/
│ ├── __init__.py
│ ├── async_m2m.py
│ ├── m2m.py
│ └── sample_tree.py
├── relationship/
│ ├── __init__.py
│ ├── many_to_many.py
│ ├── many_to_one.py
│ ├── one_to_many.py
│ └── one_to_one.py
├── sample.py
├── sample_case.py
└── sample_two_table.py
SYMBOL INDEX (1154 symbols across 169 files)
FILE: src/fastapi_quickcrud/crud_router.py
function crud_router_builder (line 32) | def crud_router_builder(
FILE: src/fastapi_quickcrud/misc/abstract_execute.py
class SQLALchemyExecuteService (line 6) | class SQLALchemyExecuteService(object):
method __init__ (line 8) | def __init__(self):
method add (line 24) | def add(session, model) -> Any:
method add_all (line 28) | def add_all(session, model) -> Any:
method async_flush (line 32) | async def async_flush(session) -> Any:
method flush (line 36) | def flush(session) -> Any:
method async_execute (line 40) | async def async_execute(session, stmt: BinaryExpression) -> Any:
method execute (line 44) | def execute(session, stmt: BinaryExpression) -> Any:
FILE: src/fastapi_quickcrud/misc/abstract_parser.py
class SQLAlchemyGeneralSQLeResultParse (line 11) | class SQLAlchemyGeneralSQLeResultParse(object):
method __init__ (line 13) | def __init__(self, async_model, crud_models, autocommit):
method async_commit (line 26) | async def async_commit(self, session):
method commit (line 31) | def commit(self, session):
method async_delete (line 36) | async def async_delete(self, session, data):
method delete (line 39) | def delete(self, session, data):
method update_data_model (line 42) | def update_data_model(self, data, update_args):
method async_rollback (line 48) | async def async_rollback(session):
method rollback (line 52) | def rollback(session):
method _response_builder (line 56) | def _response_builder(sql_execute_result, fastapi_response, response_m...
method update_func (line 77) | def update_func(self, response_model, sql_execute_result, fastapi_resp...
method update (line 92) | def update(self, *, response_model, sql_execute_result, fastapi_respon...
method async_update (line 99) | async def async_update(self, *, response_model, sql_execute_result, fa...
method find_one_sub_func (line 107) | def find_one_sub_func(sql_execute_result, response_model, fastapi_resp...
method async_find_one (line 135) | async def async_find_one(self, *, response_model, sql_execute_result, ...
method find_one (line 140) | def find_one(self, *, response_model, sql_execute_result, fastapi_resp...
method find_many_sub_func (line 146) | def find_many_sub_func(response_model, sql_execute_result, fastapi_res...
method async_find_many (line 173) | async def async_find_many(self, *, response_model, sql_execute_result,...
method find_many (line 178) | def find_many(self, *, response_model, sql_execute_result, fastapi_res...
method create_one_sub_func (line 218) | def create_one_sub_func(response_model, sql_execute_result, fastapi_re...
method async_create_one (line 224) | async def async_create_one(self, *, response_model, sql_execute_result...
method create_one (line 229) | def create_one(self, *, response_model, sql_execute_result, fastapi_re...
method create_many_sub_func (line 235) | def create_many_sub_func(response_model, sql_execute_result, fastapi_r...
method async_create_many (line 240) | async def async_create_many(self, *, response_model, sql_execute_resul...
method create_many (line 245) | def create_many(self, *, response_model, sql_execute_result, fastapi_r...
method upsert_one_sub_func (line 251) | def upsert_one_sub_func(response_model, sql_execute_result, fastapi_re...
method async_upsert_one (line 257) | async def async_upsert_one(self, *, response_model, sql_execute_result...
method upsert_one (line 262) | def upsert_one(self, *, response_model, sql_execute_result, fastapi_re...
method upsert_many_sub_func (line 268) | def upsert_many_sub_func(response_model, sql_execute_result, fastapi_r...
method async_upsert_many (line 274) | async def async_upsert_many(self, *, response_model, sql_execute_resul...
method upsert_many (line 279) | def upsert_many(self, *, response_model, sql_execute_result, fastapi_r...
method delete_one_sub_func (line 284) | def delete_one_sub_func(self, response_model, sql_execute_result, fast...
method delete_one (line 291) | def delete_one(self, *, response_model, sql_execute_result, fastapi_re...
method async_delete_one (line 299) | async def async_delete_one(self, *, response_model, sql_execute_result...
method delete_many_sub_func (line 307) | def delete_many_sub_func(self, response_model, sql_execute_result, fas...
method delete_many (line 315) | def delete_many(self, *, response_model, sql_execute_results, fastapi_...
method async_delete_many (line 324) | async def async_delete_many(self, *, response_model, sql_execute_resul...
method has_end_point (line 333) | def has_end_point(self, fastapi_request) -> bool:
method post_redirect_get_sub_func (line 343) | def post_redirect_get_sub_func(self, response_model, sql_execute_resul...
method get_post_redirect_get_url (line 350) | def get_post_redirect_get_url(self, response_model, sql_execute_result...
method async_post_redirect_get (line 356) | async def async_post_redirect_get(self, *, response_model, sql_execute...
method post_redirect_get (line 369) | def post_redirect_get(self, *, response_model, sql_execute_result, fas...
FILE: src/fastapi_quickcrud/misc/abstract_query.py
class SQLAlchemyGeneralSQLQueryService (line 15) | class SQLAlchemyGeneralSQLQueryService(ABC):
method __init__ (line 17) | def __init__(self, *, model, async_mode, foreign_table_mapping):
method get_many (line 29) | def get_many(self, *,
method get_one (line 76) | def get_one(self, *,
method create (line 95) | def create(self, *,
method upsert (line 116) | def upsert(self, *,
method insert_one (line 123) | def insert_one(self, *,
method get_join_select_fields (line 131) | def get_join_select_fields(self, join_mode=None):
method get_join_by_excpression (line 145) | def get_join_by_excpression(self, stmt: BinaryExpression, join_mode=No...
method model_query (line 173) | def model_query(self,
method get_one_with_foreign_pk (line 192) | def get_one_with_foreign_pk(self, *,
class SQLAlchemyPGSQLQueryService (line 232) | class SQLAlchemyPGSQLQueryService(SQLAlchemyGeneralSQLQueryService):
method __init__ (line 234) | def __init__(self, *, model, async_mode, foreign_table_mapping):
method upsert (line 248) | def upsert(self, *,
class SQLAlchemySQLITEQueryService (line 286) | class SQLAlchemySQLITEQueryService(SQLAlchemyGeneralSQLQueryService):
method __init__ (line 288) | def __init__(self, *, model, async_mode, foreign_table_mapping):
method upsert (line 300) | def upsert(self, *,
class SQLAlchemyMySQLQueryService (line 308) | class SQLAlchemyMySQLQueryService(SQLAlchemyGeneralSQLQueryService):
method __init__ (line 310) | def __init__(self, *, model, async_mode, foreign_table_mapping):
method upsert (line 322) | def upsert(self, *,
class SQLAlchemyMariaDBQueryService (line 330) | class SQLAlchemyMariaDBQueryService(SQLAlchemyGeneralSQLQueryService):
method __init__ (line 332) | def __init__(self, *, model, async_mode, foreign_table_mapping):
method upsert (line 344) | def upsert(self, *,
class SQLAlchemyOracleQueryService (line 352) | class SQLAlchemyOracleQueryService(SQLAlchemyGeneralSQLQueryService):
method __init__ (line 354) | def __init__(self, *, model, async_mode, foreign_table_mapping):
method upsert (line 366) | def upsert(self, *,
class SQLAlchemyMSSqlQueryService (line 374) | class SQLAlchemyMSSqlQueryService(SQLAlchemyGeneralSQLQueryService):
method __init__ (line 376) | def __init__(self, *, model, async_mode, foreign_table_mapping):
method upsert (line 388) | def upsert(self, *,
class SQLAlchemyNotSupportQueryService (line 396) | class SQLAlchemyNotSupportQueryService(SQLAlchemyGeneralSQLQueryService):
method __init__ (line 398) | def __init__(self, *, model, async_mode, foreign_table_mapping):
method upsert (line 410) | def upsert(self, *,
FILE: src/fastapi_quickcrud/misc/abstract_route.py
class SQLAlchemyGeneralSQLBaseRouteSource (line 12) | class SQLAlchemyGeneralSQLBaseRouteSource(ABC):
method find_one (line 16) | def find_one(cls, api,
method find_many (line 70) | def find_many(cls, api, *,
method upsert_one (line 120) | def upsert_one(cls, api, *,
method upsert_many (line 134) | def upsert_many(cls, api, *,
method create_one (line 149) | def create_one(cls, api, *,
method create_many (line 213) | def create_many(cls, api, *,
method delete_one (line 280) | def delete_one(cls, api, *,
method delete_many (line 333) | def delete_many(cls, api, *,
method post_redirect_get (line 376) | def post_redirect_get(cls, api, *,
method patch_one (line 433) | def patch_one(cls, api, *,
method patch_many (line 511) | def patch_many(cls, api, *,
method put_one (line 588) | def put_one(cls, api, *,
method put_many (line 663) | def put_many(cls, api, *,
method find_one_foreign_tree (line 739) | def find_one_foreign_tree(cls, api, *,
method find_many_foreign_tree (line 801) | def find_many_foreign_tree(cls, api, *,
class SQLAlchemyPGSQLRouteSource (line 859) | class SQLAlchemyPGSQLRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
method upsert_one (line 865) | def upsert_one(cls, api, *,
method upsert_many (line 926) | def upsert_many(cls, api, *,
class SQLAlchemySQLLiteRouteSource (line 986) | class SQLAlchemySQLLiteRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
method upsert_one (line 992) | def upsert_one(cls, api, *,
method upsert_many (line 1053) | def upsert_many(cls, api, *,
class SQLAlchemyMySQLRouteSource (line 1114) | class SQLAlchemyMySQLRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
method upsert_one (line 1120) | def upsert_one(cls, api, *,
method upsert_many (line 1134) | def upsert_many(cls, api, *,
class SQLAlchemyMariadbRouteSource (line 1148) | class SQLAlchemyMariadbRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
method upsert_one (line 1154) | def upsert_one(cls, api, *,
method upsert_many (line 1168) | def upsert_many(cls, api, *,
class SQLAlchemyOracleRouteSource (line 1182) | class SQLAlchemyOracleRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
method upsert_one (line 1188) | def upsert_one(cls, api, *,
method upsert_many (line 1202) | def upsert_many(cls, api, *,
class SQLAlchemyMSSQLRouteSource (line 1216) | class SQLAlchemyMSSQLRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
method upsert_one (line 1222) | def upsert_one(cls, api, *,
method upsert_many (line 1236) | def upsert_many(cls, api, *,
class SQLAlchemyNotSupportRouteSource (line 1250) | class SQLAlchemyNotSupportRouteSource(SQLAlchemyGeneralSQLBaseRouteSource):
method upsert_one (line 1256) | def upsert_one(cls, api, *,
method upsert_many (line 1270) | def upsert_many(cls, api, *,
FILE: src/fastapi_quickcrud/misc/covert_model.py
function convert_table_to_model (line 6) | def convert_table_to_model(db_model):
FILE: src/fastapi_quickcrud/misc/crud_model.py
class RequestResponseModel (line 13) | class RequestResponseModel(BaseModel):
class CRUDModel (line 25) | class CRUDModel(BaseModel):
method get_available_request_method (line 35) | def get_available_request_method(self):
method get_model_by_request_method (line 38) | def get_model_by_request_method(self, request_method):
FILE: src/fastapi_quickcrud/misc/exceptions.py
class FindOneApiNotRegister (line 4) | class FindOneApiNotRegister(HTTPException):
class CRUDBuilderException (line 8) | class CRUDBuilderException(BaseException):
class RequestMissing (line 12) | class RequestMissing(CRUDBuilderException):
class PrimaryMissing (line 16) | class PrimaryMissing(CRUDBuilderException):
class UnknownOrderType (line 20) | class UnknownOrderType(CRUDBuilderException):
class UpdateColumnEmptyException (line 24) | class UpdateColumnEmptyException(CRUDBuilderException):
class UnknownColumn (line 28) | class UnknownColumn(CRUDBuilderException):
class QueryOperatorNotFound (line 32) | class QueryOperatorNotFound(CRUDBuilderException):
class UnknownError (line 36) | class UnknownError(CRUDBuilderException):
class ConflictColumnsCannotHit (line 40) | class ConflictColumnsCannotHit(CRUDBuilderException):
class MultipleSingleUniqueNotSupportedException (line 44) | class MultipleSingleUniqueNotSupportedException(CRUDBuilderException):
class SchemaException (line 48) | class SchemaException(CRUDBuilderException):
class CompositePrimaryKeyConstraintNotSupportedException (line 52) | class CompositePrimaryKeyConstraintNotSupportedException(CRUDBuilderExce...
class MultiplePrimaryKeyNotSupportedException (line 56) | class MultiplePrimaryKeyNotSupportedException(CRUDBuilderException):
class ColumnTypeNotSupportedException (line 60) | class ColumnTypeNotSupportedException(CRUDBuilderException):
class InvalidRequestMethod (line 64) | class InvalidRequestMethod(CRUDBuilderException):
class FDDRestHTTPException (line 81) | class FDDRestHTTPException(HTTPException):
FILE: src/fastapi_quickcrud/misc/memory_sql.py
class MemorySql (line 12) | class MemorySql():
method __init__ (line 13) | def __init__(self, async_mode: bool = False):
method create_memory_table (line 44) | def create_memory_table(self, Mode: 'declarative_base()'):
method get_memory_db_session (line 55) | def get_memory_db_session(self) -> Generator:
method async_get_memory_db_session (line 65) | async def async_get_memory_db_session(self):
FILE: src/fastapi_quickcrud/misc/schema_builder.py
class ExcludeUnsetBaseModel (line 51) | class ExcludeUnsetBaseModel(BaseModel):
method dict (line 52) | def dict(self, *args, **kwargs):
class OrmConfig (line 58) | class OrmConfig(BaseConfig):
function _add_orm_model_config_into_pydantic_model (line 62) | def _add_orm_model_config_into_pydantic_model(pydantic_model, **kwargs) ...
function _model_from_dataclass (line 92) | def _model_from_dataclass(kls: DataClassT) -> Type[BaseModel]:
function _to_require_but_default (line 98) | def _to_require_but_default(model: Type[BaseModelT]) -> Type[BaseModelT]:
function _filter_none (line 111) | def _filter_none(request_or_response_object):
class ApiParameterSchemaBuilder (line 135) | class ApiParameterSchemaBuilder:
method __init__ (line 139) | def __init__(self, db_model: Type, sql_type, exclude_column=None, cons...
method __foreign_mapper_builder (line 181) | def __foreign_mapper_builder(self):
method __get_table_name_from_table (line 200) | def __get_table_name_from_table(self, table):
method __get_table_name_from_model (line 203) | def __get_table_name_from_model(self, table):
method __get_table_name (line 206) | def __get_table_name(self, table):
method extra_foreign_table (line 212) | def extra_foreign_table(self, db_model=None) -> Dict[ForeignKeyName, d...
method _extract_primary (line 220) | def _extract_primary(self, db_model_table=None) -> Union[tuple, Tuple[...
method _extract_unique (line 290) | def _extract_unique(self) -> List[str]:
method _get_field_description (line 322) | def _get_field_description(column: Column) -> str:
method _extract_all_field (line 327) | def _extract_all_field(self, columns=None) -> List[dict]:
method _extra_foreign_table_from_table (line 410) | def _extra_foreign_table_from_table(self) -> Dict[str, Table]:
method _extra_relation_level (line 482) | def _extra_relation_level(self, model=None, processed_table=None) -> D...
method _extra_foreign_table_from_declarative_base (line 503) | def _extra_foreign_table_from_declarative_base(self, model) -> Dict[st...
method _value_of_list_to_str (line 635) | def _value_of_list_to_str(request_or_response_object, columns):
method _assign_join_table_instance (line 667) | def _assign_join_table_instance(request_or_response_object, join_table...
method _get_many_string_matching_patterns_description_builder (line 677) | def _get_many_string_matching_patterns_description_builder():
method _get_many_order_by_columns_description_builder (line 683) | def _get_many_order_by_columns_description_builder(all_columns, regex_...
method _extra_default_value (line 695) | def _extra_default_value(column):
method _assign_str_matching_pattern (line 712) | def _assign_str_matching_pattern(self, field_of_param: dict, result_: ...
method _assign_list_comparison (line 732) | def _assign_list_comparison(field_of_param, result_: List[dict]) -> Li...
method _assign_range_comparison (line 750) | def _assign_range_comparison(field_of_param, result_: List[dict]) -> L...
method _assign_foreign_join (line 780) | def _assign_foreign_join(self, result_, table_of_foreign=None) -> List...
method _get_fizzy_query_param (line 791) | def _get_fizzy_query_param(self, exclude_column: List[str] = None, fie...
method _assign_pagination_param (line 824) | def _assign_pagination_param(self, result_: List[tuple]) -> List[Union...
method upsert_one (line 844) | def upsert_one(self) -> Tuple:
method upsert_many (line 892) | def upsert_many(self) -> Tuple:
method create_one (line 955) | def create_one(self) -> Tuple:
method create_many (line 991) | def create_many(self) -> Tuple:
method find_many (line 1041) | def find_many(self) -> Tuple:
method _extra_relation_primary_key (line 1096) | def _extra_relation_primary_key(self, relation_dbs):
method find_one (line 1160) | def find_one(self) -> Tuple:
method delete_one (line 1218) | def delete_one(self) -> Tuple:
method delete_many (line 1258) | def delete_many(self) -> Tuple:
method patch (line 1312) | def patch(self) -> Tuple:
method update_one (line 1369) | def update_one(self) -> Tuple:
method update_many (line 1426) | def update_many(self) -> Tuple:
method patch_many (line 1494) | def patch_many(self) -> Tuple:
method post_redirect_get (line 1566) | def post_redirect_get(self) -> Tuple:
method foreign_tree_get_many (line 1601) | def foreign_tree_get_many(self) -> Tuple:
method foreign_tree_get_one (line 1691) | def foreign_tree_get_one(self) -> Tuple:
FILE: src/fastapi_quickcrud/misc/type.py
class SqlType (line 9) | class SqlType(StrEnum):
class Ordering (line 17) | class Ordering(StrEnum):
class CrudMethods (line 22) | class CrudMethods(Enum):
method get_table_full_crud_method (line 40) | def get_table_full_crud_method():
method get_declarative_model_full_crud_method (line 45) | def get_declarative_model_full_crud_method():
class RequestMethods (line 53) | class RequestMethods(Enum):
class CRUDRequestMapping (line 61) | class CRUDRequestMapping(Enum):
method get_request_method_by_crud_method (line 87) | def get_request_method_by_crud_method(cls, value):
class ExtraFieldType (line 95) | class ExtraFieldType(StrEnum):
class ExtraFieldTypePrefix (line 100) | class ExtraFieldTypePrefix(StrEnum):
class RangeFromComparisonOperators (line 107) | class RangeFromComparisonOperators(StrEnum):
class RangeToComparisonOperators (line 112) | class RangeToComparisonOperators(StrEnum):
class ItemComparisonOperators (line 117) | class ItemComparisonOperators(StrEnum):
class MatchingPatternInStringBase (line 124) | class MatchingPatternInStringBase(StrEnum):
class PGSQLMatchingPattern (line 132) | class PGSQLMatchingPattern(StrEnum):
class JSONMatchingMode (line 146) | class JSONMatchingMode(str, Enum):
class JSONBMatchingMode (line 152) | class JSONBMatchingMode(str, Enum):
class SessionObject (line 158) | class SessionObject(StrEnum):
FILE: src/fastapi_quickcrud/misc/utils.py
function clean_input_fields (line 44) | def clean_input_fields(param: Union[dict, list], model: Base):
function find_query_builder (line 67) | def find_query_builder(param: dict, model: Base) -> List[Union[BinaryExp...
class OrmConfig (line 98) | class OrmConfig(BaseConfig):
function sqlalchemy_to_pydantic (line 102) | def sqlalchemy_to_pydantic(
function table_to_declarative_base (line 305) | def table_to_declarative_base(db_model):
function group_find_many_join (line 320) | def group_find_many_join(list_of_dict: List[dict]) -> List[dict]:
function path_query_builder (line 345) | def path_query_builder(params, model) -> List[Union[BinaryExpression]]:
FILE: tests/conf/config.py
class BaseConfig (line 9) | class BaseConfig:
method __init__ (line 16) | def __init__(self):
method _apply_dot_env (line 22) | def _apply_dot_env(self):
method _apply_env_vars (line 33) | def _apply_env_vars(self):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/__init__.py
class UntitledTable256 (line 16) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/foreign_tree/test_relationship_m2m.py
function get_transaction_session (line 33) | async def get_transaction_session():
class Child (line 49) | class Child(Base):
class Parent (line 57) | class Parent(Base):
class ChildSecond (line 67) | class ChildSecond(Base):
function test_get_one_1 (line 146) | def test_get_one_1():
function test_get_one_2 (line 208) | def test_get_one_2():
function test_get_many_1 (line 270) | def test_get_many_1():
function test_get_many_2 (line 327) | def test_get_many_2():
function setup_module (line 384) | def setup_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_create_many_api.py
function create_example_data (line 28) | def create_example_data():
function test_try_only_input_required_fields (line 41) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 58) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_without_conflict (line 81) | def test_try_input_without_conflict():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_create_one_api.py
function create_example_data (line 75) | def create_example_data():
function test_try_only_input_required_fields (line 88) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 103) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 129) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 148) | def test_try_input_without_conflict():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_delete_many_api.py
function test_create_many_and_delete_many (line 86) | def test_create_many_and_delete_many():
function test_create_many_and_delete_many_but_not_found (line 177) | def test_create_many_and_delete_many_but_not_found():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_delete_one_api.py
function test_create_one_and_delete_one (line 86) | def test_create_one_and_delete_one():
function test_create_one_and_delete_one_but_not_found (line 162) | def test_create_one_and_delete_one_but_not_found():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_get_many_api.py
function create_example_data (line 39) | def create_example_data(num=1, **kwargs):
function test_pagination_and_ording (line 69) | def test_pagination_and_ording():
function test_create_new_data_and_get_by_primary_key (line 83) | def test_create_new_data_and_get_by_primary_key():
function test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type_and_get_many (line 111) | def test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type...
function test_create_a_more_than_one_data_and_get_many_1 (line 244) | def test_create_a_more_than_one_data_and_get_many_1():
function test_create_a_more_than_one_data_and_get_many_2 (line 1508) | def test_create_a_more_than_one_data_and_get_many_2():
function test_get_many_with_ordering_unknown_column (line 1614) | def test_get_many_with_ordering_unknown_column():
function test_get_many_with_ordering_with_default_order (line 1622) | def test_get_many_with_ordering_with_default_order():
function test_get_many_with_ordering_with_ASC (line 1630) | def test_get_many_with_ordering_with_ASC():
function test_get_many_with_ordering_with_DESC (line 1638) | def test_get_many_with_ordering_with_DESC():
function test_get_many_with_unknown_order_tyoe (line 1647) | def test_get_many_with_unknown_order_tyoe():
function test_get_many_with_ordering_with_empty_input_list (line 1656) | def test_get_many_with_ordering_with_empty_input_list():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_get_one_api.py
function test_get_by_primary_key_without_any_query_param (line 70) | def test_get_by_primary_key_without_any_query_param():
function test_get_by_primary_key_with_false_bool_query_param (line 78) | def test_get_by_primary_key_with_false_bool_query_param():
function test_get_by_primary_key_with_false_char_query_param (line 86) | def test_get_by_primary_key_with_false_char_query_param():
function test_get_by_primary_key_with_false_float4_query_param (line 187) | def test_get_by_primary_key_with_false_float4_query_param():
function test_get_by_primary_key_with_false_float8_query_param (line 236) | def test_get_by_primary_key_with_false_float8_query_param():
function test_get_by_primary_key_with_false_int2_query_param (line 285) | def test_get_by_primary_key_with_false_int2_query_param():
function test_get_by_primary_key_with_false_int4_query_param (line 334) | def test_get_by_primary_key_with_false_int4_query_param():
function test_get_by_primary_key_with_false_int8_query_param (line 383) | def test_get_by_primary_key_with_false_int8_query_param():
function test_get_by_primary_key_with_false_numeric_query_param (line 433) | def test_get_by_primary_key_with_false_numeric_query_param():
function test_get_by_primary_key_with_false_text_query_param (line 482) | def test_get_by_primary_key_with_false_text_query_param():
function test_get_by_primary_key_with_false_varchar_query_param (line 564) | def test_get_by_primary_key_with_false_varchar_query_param():
function test_get_by_primary_key_with_false_date_range_query_param (line 622) | def test_get_by_primary_key_with_false_date_range_query_param():
function test_get_by_primary_key_with_false_time_range_query_param (line 660) | def test_get_by_primary_key_with_false_time_range_query_param():
function test_get_by_primary_key_with_false_timestamp_range_query_param (line 699) | def test_get_by_primary_key_with_false_timestamp_range_query_param():
function test_get_by_primary_key_with_false_timetz_range_query_param (line 743) | def test_get_by_primary_key_with_false_timetz_range_query_param():
function test_get_by_primary_key_with_false_timestamptz_range_query_param (line 783) | def test_get_by_primary_key_with_false_timestamptz_range_query_param():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_other_default_value.py
class UUIDTable (line 25) | class UUIDTable(Base):
function test_get_one_data_and_create_one_data (line 96) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 115) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 132) | def test_update_one_data():
function test_create_many_data (line 158) | def test_create_many_data():
function test_patch_one_data (line 258) | def test_patch_one_data():
function test_patch_many_data (line 364) | def test_patch_many_data():
function test_delete_one_data (line 467) | def test_delete_one_data():
function test_delete_many_data (line 539) | def test_delete_many_data():
function test_post_redirect_get_data (line 627) | def test_post_redirect_get_data():
function test_create_one (line 688) | def test_create_one():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_other_set_description.py
class UUIDTable (line 25) | class UUIDTable(Base):
function test_get_one_data_and_create_one_data (line 105) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 124) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 186) | def test_update_one_data():
function test_update_many_data (line 212) | def test_update_many_data():
function test_patch_one_data (line 310) | def test_patch_one_data():
function test_patch_many_data (line 415) | def test_patch_many_data():
function test_delete_one_data (line 517) | def test_delete_one_data():
function test_delete_many_data (line 589) | def test_delete_many_data():
function test_post_redirect_get_data (line 677) | def test_post_redirect_get_data():
function test_upsert_one (line 732) | def test_upsert_one():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_other_single_unique.py
class UUIDTable (line 30) | class UUIDTable(Base):
function test_get_one_data_and_create_one_data (line 107) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 126) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 189) | def test_update_one_data():
function test_update_many_data (line 214) | def test_update_many_data():
function test_patch_one_data (line 314) | def test_patch_one_data():
function test_patch_many_data (line 419) | def test_patch_many_data():
function test_delete_one_data (line 520) | def test_delete_one_data():
function test_delete_many_data (line 592) | def test_delete_many_data():
function test_post_redirect_get_data (line 679) | def test_post_redirect_get_data():
function test_upsert_one (line 736) | def test_upsert_one():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_patch_many_api.py
function test_create_many_and_patch_many (line 83) | def test_create_many_and_patch_many():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_patch_one_api.py
function test_create_one_and_patch_one (line 85) | def test_create_one_and_patch_one():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_post_redirect_get_api.py
function test_create_one_but_no_follow_redirect (line 60) | def test_create_one_but_no_follow_redirect():
function test_create_one_with_redirect (line 72) | def test_create_one_with_redirect():
function test_create_but_conflict (line 130) | def test_create_but_conflict():
function test_create_but_not_found_get_api (line 142) | def test_create_but_not_found_get_api():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_put_many_api.py
function test_create_many_and_update_many (line 81) | def test_create_many_and_update_many():
function test_create_many_and_update_many_but_not_found (line 182) | def test_create_many_and_update_many_but_not_found():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_put_one_api.py
function test_create_one_and_update_one (line 82) | def test_create_one_and_update_one():
function test_create_one_and_update_one_but_not_found (line 164) | def test_create_one_and_update_one_but_not_found():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/__init__.py
class UntitledTable256 (line 17) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/foreign_tree/test_relationship_m2m.py
function get_transaction_session (line 23) | def get_transaction_session():
class Child (line 42) | class Child(Base):
class Parent (line 50) | class Parent(Base):
class ChildSecond (line 60) | class ChildSecond(Base):
function test_get_one_1 (line 132) | def test_get_one_1():
function test_get_one_2 (line 194) | def test_get_one_2():
function test_get_many_1 (line 256) | def test_get_many_1():
function test_get_many_2 (line 313) | def test_get_many_2():
function setup_module (line 370) | def setup_module(module):
function teardown_module (line 415) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_extra.py
function get_transaction_session (line 24) | def get_transaction_session():
class User (line 32) | class User(Base):
function test_ (line 64) | def test_():
function setup_module (line 103) | def setup_module(module):
function teardown_module (line 108) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2m.py
function get_transaction_session (line 21) | def get_transaction_session():
class Child (line 40) | class Child(Base):
class Parent (line 45) | class Parent(Base):
class ChildSecond (line 54) | class ChildSecond(Base):
function test_get_parent_many_with_join (line 101) | def test_get_parent_many_with_join():
function test_get_child_many_without_join (line 277) | def test_get_child_many_without_join():
function test_get_association_many_with_join (line 307) | def test_get_association_many_with_join():
function test_get_association_many_second_with_join (line 498) | def test_get_association_many_second_with_join():
function test_get_child_many_second_with_join (line 593) | def test_get_child_many_second_with_join():
function setup_module (line 623) | def setup_module(module):
function teardown_module (line 668) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2m_back_populates.py
function get_transaction_session (line 25) | def get_transaction_session():
class Child (line 43) | class Child(Base):
class ChildSecond (line 51) | class ChildSecond(Base):
class Parent (line 59) | class Parent(Base):
function test_get_parent_many_with_join (line 107) | def test_get_parent_many_with_join():
function test_get_child_many_without_join (line 190) | def test_get_child_many_without_join():
function test_get_child_many_with_join (line 214) | def test_get_child_many_with_join():
function test_get_association_many_with_join (line 258) | def test_get_association_many_with_join():
function test_get_association_many_second_with_join (line 408) | def test_get_association_many_second_with_join():
function test_get_child_many_second_with_join (line 503) | def test_get_child_many_second_with_join():
function setup_module (line 581) | def setup_module(module):
function teardown_module (line 620) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2o.py
function get_transaction_session (line 26) | def get_transaction_session():
class Parent (line 34) | class Parent(Base):
class Child (line 41) | class Child(Base):
function test_get_many_with_join (line 64) | def test_get_many_with_join():
function test_get_child_many_with_join (line 124) | def test_get_child_many_with_join():
function test_get_many_without_join (line 136) | def test_get_many_without_join():
function setup_module (line 152) | def setup_module(module):
function teardown_module (line 171) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2o_back_populates.py
function get_transaction_session (line 26) | def get_transaction_session():
class Parent (line 34) | class Parent(Base):
class Child (line 40) | class Child(Base):
function test_get_parent_many_with_join (line 64) | def test_get_parent_many_with_join():
function test_get_child_many_with_join (line 125) | def test_get_child_many_with_join():
function test_get_child_many_without_join (line 157) | def test_get_child_many_without_join():
function test_get_parent_many_without_join (line 192) | def test_get_parent_many_without_join():
function setup_module (line 222) | def setup_module(module):
function teardown_module (line 241) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2o_back_refer.py
function get_transaction_session (line 25) | def get_transaction_session():
class Child (line 33) | class Child(Base):
class Parent (line 36) | class Parent(Base):
function test_get_parent_many_with_join (line 61) | def test_get_parent_many_with_join():
function test_get_child_many_with_join (line 122) | def test_get_child_many_with_join():
function test_get_child_many_without_join (line 175) | def test_get_child_many_without_join():
function test_get_parent_many_without_join (line 210) | def test_get_parent_many_without_join():
function setup_module (line 240) | def setup_module(module):
function teardown_module (line 259) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_o2m.py
function get_transaction_session (line 26) | def get_transaction_session():
class Parent (line 34) | class Parent(Base):
class Child (line 40) | class Child(Base):
function test_get_many_with_join (line 64) | def test_get_many_with_join():
function test_get_child_many_with_join (line 118) | def test_get_child_many_with_join():
function test_get_many_without_join (line 150) | def test_get_many_without_join():
function setup_module (line 176) | def setup_module(module):
function teardown_module (line 193) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_o2m_back_populates.py
function get_transaction_session (line 26) | def get_transaction_session():
class Parent (line 33) | class Parent(Base):
class Child (line 38) | class Child(Base):
function test_get_many_with_join (line 62) | def test_get_many_with_join():
function test_get_child_many_with_join (line 115) | def test_get_child_many_with_join():
function test_get_many_without_join (line 147) | def test_get_many_without_join():
function setup_module (line 172) | def setup_module(module):
function teardown_module (line 188) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_o2m_back_ref.py
function get_transaction_session (line 26) | def get_transaction_session():
class Parent (line 33) | class Parent(Base):
class Child (line 38) | class Child(Base):
function test_get_many_with_join (line 61) | def test_get_many_with_join():
function test_get_child_many_with_join (line 92) | def test_get_child_many_with_join():
function test_get_many_without_join (line 123) | def test_get_many_without_join():
function setup_module (line 149) | def setup_module(module):
function teardown_module (line 165) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_o2o.py
function get_transaction_session (line 25) | def get_transaction_session():
class Parent (line 32) | class Parent(Base):
class Child (line 39) | class Child(Base):
method test_function (line 47) | def test_function(self, *args, **kwargs ):
function test_get_parent_many_with_join (line 66) | def test_get_parent_many_with_join():
function test_get_child_many_with_join (line 97) | def test_get_child_many_with_join():
function test_get_child_many_without_join (line 122) | def test_get_child_many_without_join():
function test_get_parent_many_without_join (line 146) | def test_get_parent_many_without_join():
function setup_module (line 181) | def setup_module(module):
function teardown_module (line 199) | def teardown_module(module):
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_create_many_api.py
function create_example_data (line 29) | def create_example_data():
function test_try_only_input_required_fields (line 42) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 59) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_without_conflict (line 82) | def test_try_input_without_conflict():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_create_one_api.py
function create_example_data (line 74) | def create_example_data():
function test_try_only_input_required_fields (line 87) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 102) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 128) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 147) | def test_try_input_without_conflict():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_delete_many_api.py
function test_create_many_and_delete_many (line 73) | def test_create_many_and_delete_many():
function test_create_many_and_delete_many_but_not_found (line 163) | def test_create_many_and_delete_many_but_not_found():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_delete_one_api.py
function test_create_one_and_delete_one (line 81) | def test_create_one_and_delete_one():
function test_create_one_and_delete_one_but_not_found (line 153) | def test_create_one_and_delete_one_but_not_found():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_get_many_api.py
function create_example_data (line 33) | def create_example_data(num=1, **kwargs):
function test_pagination_and_ording (line 63) | def test_pagination_and_ording():
function test_create_new_data_and_get_by_primary_key (line 77) | def test_create_new_data_and_get_by_primary_key():
function test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type_and_get_many (line 105) | def test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type...
function test_create_a_more_than_one_data_and_get_many_1 (line 228) | def test_create_a_more_than_one_data_and_get_many_1():
function test_create_a_more_than_one_data_and_get_many_2 (line 1482) | def test_create_a_more_than_one_data_and_get_many_2():
function test_get_many_with_ordering_unknown_column (line 1579) | def test_get_many_with_ordering_unknown_column():
function test_get_many_with_ordering_with_default_order (line 1588) | def test_get_many_with_ordering_with_default_order():
function test_get_many_with_ordering_with_ASC (line 1597) | def test_get_many_with_ordering_with_ASC():
function test_get_many_with_ordering_with_DESC (line 1606) | def test_get_many_with_ordering_with_DESC():
function test_get_many_with_unknown_order_tyoe (line 1615) | def test_get_many_with_unknown_order_tyoe():
function test_get_many_with_ordering_with_empty_input_list (line 1624) | def test_get_many_with_ordering_with_empty_input_list():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_get_one_api.py
function test_get_by_primary_key_without_any_query_param (line 68) | def test_get_by_primary_key_without_any_query_param():
function test_get_by_primary_key_with_false_bool_query_param (line 76) | def test_get_by_primary_key_with_false_bool_query_param():
function test_get_by_primary_key_with_false_char_query_param (line 84) | def test_get_by_primary_key_with_false_char_query_param():
function test_get_by_primary_key_with_false_float4_query_param (line 192) | def test_get_by_primary_key_with_false_float4_query_param():
function test_get_by_primary_key_with_false_float8_query_param (line 241) | def test_get_by_primary_key_with_false_float8_query_param():
function test_get_by_primary_key_with_false_int2_query_param (line 290) | def test_get_by_primary_key_with_false_int2_query_param():
function test_get_by_primary_key_with_false_int4_query_param (line 339) | def test_get_by_primary_key_with_false_int4_query_param():
function test_get_by_primary_key_with_false_int8_query_param (line 388) | def test_get_by_primary_key_with_false_int8_query_param():
function test_get_by_primary_key_with_false_numeric_query_param (line 438) | def test_get_by_primary_key_with_false_numeric_query_param():
function test_get_by_primary_key_with_false_text_query_param (line 487) | def test_get_by_primary_key_with_false_text_query_param():
function test_get_by_primary_key_with_false_varchar_query_param (line 569) | def test_get_by_primary_key_with_false_varchar_query_param():
function test_get_by_primary_key_with_false_date_range_query_param (line 627) | def test_get_by_primary_key_with_false_date_range_query_param():
function test_get_by_primary_key_with_false_time_range_query_param (line 665) | def test_get_by_primary_key_with_false_time_range_query_param():
function test_get_by_primary_key_with_false_timestamp_range_query_param (line 704) | def test_get_by_primary_key_with_false_timestamp_range_query_param():
function test_get_by_primary_key_with_false_timetz_range_query_param (line 747) | def test_get_by_primary_key_with_false_timetz_range_query_param():
function test_get_by_primary_key_with_false_timestamptz_range_query_param (line 787) | def test_get_by_primary_key_with_false_timestamptz_range_query_param():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_other_default_value.py
class UUIDTable (line 25) | class UUIDTable(Base):
function test_get_one_data_and_create_one_data (line 102) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 121) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 138) | def test_update_one_data():
function test_update_many_data (line 164) | def test_update_many_data():
function test_patch_one_data (line 264) | def test_patch_one_data():
function test_patch_many_data (line 370) | def test_patch_many_data():
function test_delete_one_data (line 473) | def test_delete_one_data():
function test_delete_many_data (line 545) | def test_delete_many_data():
function test_post_redirect_get_data (line 633) | def test_post_redirect_get_data():
function test_upsert_one (line 688) | def test_upsert_one():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_other_set_description.py
class UUIDTable (line 30) | class UUIDTable(Base):
function test_get_one_data_and_create_one_data (line 108) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 127) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 189) | def test_update_one_data():
function test_update_many_data (line 215) | def test_update_many_data():
function test_patch_one_data (line 310) | def test_patch_one_data():
function test_patch_many_data (line 414) | def test_patch_many_data():
function test_delete_one_data (line 513) | def test_delete_one_data():
function test_delete_many_data (line 584) | def test_delete_many_data():
function test_post_redirect_get_data (line 669) | def test_post_redirect_get_data():
function test_upsert_one (line 725) | def test_upsert_one():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_other_single_unique.py
class UUIDTable (line 30) | class UUIDTable(Base):
function test_get_one_data_and_create_one_data (line 104) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 123) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 186) | def test_update_one_data():
function test_update_many_data (line 211) | def test_update_many_data():
function test_patch_one_data (line 311) | def test_patch_one_data():
function test_patch_many_data (line 416) | def test_patch_many_data():
function test_delete_one_data (line 517) | def test_delete_one_data():
function test_delete_many_data (line 589) | def test_delete_many_data():
function test_post_redirect_get_data (line 676) | def test_post_redirect_get_data():
function test_upsert_one (line 733) | def test_upsert_one():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_patch_many_api.py
function test_create_many_and_patch_many (line 78) | def test_create_many_and_patch_many():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_patch_one_api.py
function test_create_one_and_patch_one (line 80) | def test_create_one_and_patch_one():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_post_redirect_get_api.py
function test_create_one_but_no_follow_redirect (line 57) | def test_create_one_but_no_follow_redirect():
function test_create_one_with_redirect (line 69) | def test_create_one_with_redirect():
function test_create_but_conflict (line 127) | def test_create_but_conflict():
function test_create_but_not_found_get_api (line 139) | def test_create_but_not_found_get_api():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_put_many_api.py
function test_create_many_and_update_many (line 76) | def test_create_many_and_update_many():
function test_create_many_and_update_many_but_not_found (line 177) | def test_create_many_and_update_many_but_not_found():
FILE: tests/test_implementations/test_memory_sqlalchemy/api_test/test_put_one_api.py
function test_create_one_and_update_one (line 77) | def test_create_one_and_update_one():
function test_create_one_and_update_one_but_not_found (line 159) | def test_create_one_and_update_one_but_not_found():
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_create_null_type.py
class UntitledTable256 (line 14) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_blob_type_column.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_composite_primary.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_more_than_one_pk.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_more_than_one_unique.py
class UntitledTable256 (line 11) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unique_and_composite_unique.py
class UntitledTable256 (line 11) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unsupported_type_pk.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unsupported_type_pk_2.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unsupported_type_pk_3.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unsupported_type_pk_4.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy/api_test/__init__.py
function get_transaction_session (line 23) | def get_transaction_session():
class UntitledTable256 (line 31) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2m.py
function get_transaction_session (line 25) | def get_transaction_session():
class Child (line 43) | class Child(Base):
class Parent (line 47) | class Parent(Base):
class ChildSecond (line 55) | class ChildSecond(Base):
function test_get_parent_many_with_join (line 96) | def test_get_parent_many_with_join():
function test_get_child_many_without_join (line 271) | def test_get_child_many_without_join():
function test_get_association_many_with_join (line 301) | def test_get_association_many_with_join():
function test_get_association_many_second_with_join (line 492) | def test_get_association_many_second_with_join():
function test_get_child_many_second_with_join (line 662) | def test_get_child_many_second_with_join():
function setup_module (line 691) | def setup_module(module):
function teardown_module (line 731) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2m_back_populates.py
function get_transaction_session (line 24) | def get_transaction_session():
class Child (line 43) | class Child(Base):
class ChildSecond (line 51) | class ChildSecond(Base):
class Parent (line 59) | class Parent(Base):
function test_get_parent_many_with_join (line 107) | def test_get_parent_many_with_join():
function test_get_child_many_without_join (line 189) | def test_get_child_many_without_join():
function test_get_child_many_with_join (line 213) | def test_get_child_many_with_join():
function test_get_association_many_with_join (line 258) | def test_get_association_many_with_join():
function test_get_association_many_second_with_join (line 408) | def test_get_association_many_second_with_join():
function test_get_child_many_second_with_join (line 579) | def test_get_child_many_second_with_join():
function setup_module (line 657) | def setup_module(module):
function teardown_module (line 697) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2o.py
function get_transaction_session (line 25) | def get_transaction_session():
class Parent (line 33) | class Parent(Base):
class Child (line 40) | class Child(Base):
function test_get_many_with_join (line 63) | def test_get_many_with_join():
function test_get_child_many_with_join (line 123) | def test_get_child_many_with_join():
function test_get_many_without_join (line 135) | def test_get_many_without_join():
function setup_module (line 151) | def setup_module(module):
function teardown_module (line 170) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2o_back_populates.py
function get_transaction_session (line 25) | def get_transaction_session():
class Parent (line 33) | class Parent(Base):
class Child (line 39) | class Child(Base):
function test_get_parent_many_with_join (line 63) | def test_get_parent_many_with_join():
function test_get_child_many_with_join (line 124) | def test_get_child_many_with_join():
function test_get_child_many_without_join (line 180) | def test_get_child_many_without_join():
function test_get_parent_many_without_join (line 215) | def test_get_parent_many_without_join():
function setup_module (line 245) | def setup_module(module):
function teardown_module (line 264) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2o_back_refer.py
function get_transaction_session (line 25) | def get_transaction_session():
class Child (line 33) | class Child(Base):
class Parent (line 36) | class Parent(Base):
function test_get_parent_many_with_join (line 61) | def test_get_parent_many_with_join():
function test_get_child_many_with_join (line 122) | def test_get_child_many_with_join():
function test_get_child_many_without_join (line 175) | def test_get_child_many_without_join():
function test_get_parent_many_without_join (line 210) | def test_get_parent_many_without_join():
function setup_module (line 240) | def setup_module(module):
function teardown_module (line 259) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_o2m.py
function get_transaction_session (line 25) | def get_transaction_session():
class Parent (line 33) | class Parent(Base):
class Child (line 39) | class Child(Base):
function test_get_many_with_join (line 63) | def test_get_many_with_join():
function test_get_child_many_with_join (line 117) | def test_get_child_many_with_join():
function test_get_many_without_join (line 149) | def test_get_many_without_join():
function setup_module (line 175) | def setup_module(module):
function teardown_module (line 192) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_o2m_back_populates.py
function get_transaction_session (line 25) | def get_transaction_session():
class Parent (line 32) | class Parent(Base):
class Child (line 37) | class Child(Base):
function test_get_many_with_join (line 61) | def test_get_many_with_join():
function test_get_child_many_with_join (line 114) | def test_get_child_many_with_join():
function test_get_many_without_join (line 146) | def test_get_many_without_join():
function setup_module (line 171) | def setup_module(module):
function teardown_module (line 187) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_o2m_back_ref.py
function get_transaction_session (line 25) | def get_transaction_session():
class Parent (line 32) | class Parent(Base):
class Child (line 37) | class Child(Base):
function test_get_many_with_join (line 60) | def test_get_many_with_join():
function test_get_child_many_with_join (line 113) | def test_get_child_many_with_join():
function test_get_many_without_join (line 144) | def test_get_many_without_join():
function setup_module (line 170) | def setup_module(module):
function teardown_module (line 186) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_o2o.py
function get_transaction_session (line 25) | def get_transaction_session():
class Parent (line 32) | class Parent(Base):
class Child (line 39) | class Child(Base):
method test_function (line 47) | def test_function(self, *args, **kwargs ):
function test_get_parent_many_with_join (line 66) | def test_get_parent_many_with_join():
function test_get_child_many_with_join (line 121) | def test_get_child_many_with_join():
function test_get_child_many_without_join (line 180) | def test_get_child_many_without_join():
function test_get_parent_many_without_join (line 204) | def test_get_parent_many_without_join():
function setup_module (line 239) | def setup_module(module):
function teardown_module (line 257) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_create_many_api.py
function create_example_data (line 34) | def create_example_data():
function test_try_only_input_required_fields (line 47) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 64) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 94) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 124) | def test_try_input_without_conflict():
function test_update_specific_columns_when_conflict (line 145) | def test_update_specific_columns_when_conflict():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_create_one_api.py
function create_example_data (line 64) | def create_example_data():
function test_try_only_input_required_fields (line 77) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 92) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 118) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 143) | def test_try_input_without_conflict():
function test_update_specific_columns_when_conflict (line 161) | def test_update_specific_columns_when_conflict():
function test_try_input_with_conflict_but_missing_update_columns (line 326) | def test_try_input_with_conflict_but_missing_update_columns():
function test_try_input_with_conflict_but_unknown_update_columns (line 347) | def test_try_input_with_conflict_but_unknown_update_columns():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_delete_many_api.py
function test_create_many_and_delete_many (line 193) | def test_create_many_and_delete_many():
function test_create_many_and_delete_many_but_not_found (line 284) | def test_create_many_and_delete_many_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_delete_one_api.py
function test_create_one_and_delete_one (line 290) | def test_create_one_and_delete_one():
function test_create_one_and_delete_one_but_not_found (line 366) | def test_create_one_and_delete_one_but_not_found():
function test_create_one_and_delete_one_but_not_found_test_case_sensitive (line 440) | def test_create_one_and_delete_one_but_not_found_test_case_sensitive():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_get_many_api.py
function create_example_data (line 101) | def create_example_data(num=1, **kwargs):
function test_pagination_and_ording (line 137) | def test_pagination_and_ording():
function test_create_new_data_and_get_by_primary_key (line 155) | def test_create_new_data_and_get_by_primary_key():
function test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type_and_get_many (line 183) | def test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type...
function test_create_a_more_than_one_data_and_get_many_1 (line 350) | def test_create_a_more_than_one_data_and_get_many_1():
function test_create_a_more_than_one_data_and_get_many_2 (line 1670) | def test_create_a_more_than_one_data_and_get_many_2():
function test_get_many_with_ordering_unknown_column (line 1788) | def test_get_many_with_ordering_unknown_column():
function test_get_many_with_ordering_with_default_order (line 1796) | def test_get_many_with_ordering_with_default_order():
function test_get_many_with_ordering_with_ASC (line 1804) | def test_get_many_with_ordering_with_ASC():
function test_get_many_with_ordering_with_DESC (line 1812) | def test_get_many_with_ordering_with_DESC():
function test_get_many_with_unknown_order_tyoe (line 1821) | def test_get_many_with_unknown_order_tyoe():
function test_get_many_with_ordering_with_empty_input_list (line 1830) | def test_get_many_with_ordering_with_empty_input_list():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_get_one_api.py
function test_get_by_primary_key_without_any_query_param (line 66) | def test_get_by_primary_key_without_any_query_param():
function test_get_by_primary_key_with_false_bool_query_param (line 74) | def test_get_by_primary_key_with_false_bool_query_param():
function test_get_by_primary_key_with_false_char_query_param (line 82) | def test_get_by_primary_key_with_false_char_query_param():
function test_get_by_primary_key_with_false_float4_query_param (line 183) | def test_get_by_primary_key_with_false_float4_query_param():
function test_get_by_primary_key_with_false_float8_query_param (line 232) | def test_get_by_primary_key_with_false_float8_query_param():
function test_get_by_primary_key_with_false_int2_query_param (line 281) | def test_get_by_primary_key_with_false_int2_query_param():
function test_get_by_primary_key_with_false_int4_query_param (line 330) | def test_get_by_primary_key_with_false_int4_query_param():
function test_get_by_primary_key_with_false_int8_query_param (line 379) | def test_get_by_primary_key_with_false_int8_query_param():
function test_get_by_primary_key_with_false_numeric_query_param (line 429) | def test_get_by_primary_key_with_false_numeric_query_param():
function test_get_by_primary_key_with_false_text_query_param (line 478) | def test_get_by_primary_key_with_false_text_query_param():
function test_get_by_primary_key_with_false_uuid_query_param (line 536) | def test_get_by_primary_key_with_false_uuid_query_param():
function test_get_by_primary_key_with_false_varchar_query_param (line 560) | def test_get_by_primary_key_with_false_varchar_query_param():
function test_get_by_primary_key_with_false_date_range_query_param (line 618) | def test_get_by_primary_key_with_false_date_range_query_param():
function test_get_by_primary_key_with_false_time_range_query_param (line 656) | def test_get_by_primary_key_with_false_time_range_query_param():
function test_get_by_primary_key_with_false_timestamp_range_query_param (line 695) | def test_get_by_primary_key_with_false_timestamp_range_query_param():
function test_get_by_primary_key_with_false_timetz_range_query_param (line 738) | def test_get_by_primary_key_with_false_timetz_range_query_param():
function test_get_by_primary_key_with_false_timestamptz_range_query_param (line 778) | def test_get_by_primary_key_with_false_timestamptz_range_query_param():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_other_default_value.py
function get_transaction_session (line 32) | def get_transaction_session():
class UUIDTable (line 40) | class UUIDTable(Base):
function test_get_one_data_and_create_one_data (line 119) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 138) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 155) | def test_update_one_data():
function test_update_many_data (line 182) | def test_update_many_data():
function test_patch_one_data (line 284) | def test_patch_one_data():
function test_patch_many_data (line 391) | def test_patch_many_data():
function test_delete_one_data (line 496) | def test_delete_one_data():
function test_delete_many_data (line 568) | def test_delete_many_data():
function test_post_redirect_get_data (line 657) | def test_post_redirect_get_data():
function test_upsert_one (line 718) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_other_set_description.py
function get_transaction_session (line 34) | def get_transaction_session():
class UUIDTable (line 42) | class UUIDTable(Base):
function test_get_one_data_and_create_one_data (line 124) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 143) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 160) | def test_update_one_data():
function test_update_many_data (line 187) | def test_update_many_data():
function test_patch_one_data (line 288) | def test_patch_one_data():
function test_patch_many_data (line 395) | def test_patch_many_data():
function test_delete_one_data (line 500) | def test_delete_one_data():
function test_delete_many_data (line 572) | def test_delete_many_data():
function test_post_redirect_get_data (line 661) | def test_post_redirect_get_data():
function test_upsert_one (line 723) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_other_single_unique.py
function get_transaction_session (line 34) | def get_transaction_session():
class UUIDTable (line 42) | class UUIDTable(Base):
function setup_module (line 69) | def setup_module(module):
function test_get_one_data_and_create_one_data (line 122) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 141) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 158) | def test_update_one_data():
function test_update_many_data (line 184) | def test_update_many_data():
function test_patch_one_data (line 285) | def test_patch_one_data():
function test_patch_many_data (line 391) | def test_patch_many_data():
function test_delete_one_data (line 494) | def test_delete_one_data():
function test_delete_many_data (line 566) | def test_delete_many_data():
function test_post_redirect_get_data (line 654) | def test_post_redirect_get_data():
function test_upsert_one (line 717) | def test_upsert_one():
function teardown_module (line 744) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_other_uuid_primary.py
function get_transaction_session (line 34) | def get_transaction_session():
class UUIDTable (line 42) | class UUIDTable(Base):
function test_get_one_data_and_create_one_data (line 124) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 143) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 160) | def test_update_one_data():
function test_update_many_data (line 186) | def test_update_many_data():
function test_patch_one_data (line 286) | def test_patch_one_data():
function test_patch_many_data (line 392) | def test_patch_many_data():
function test_delete_one_data (line 496) | def test_delete_one_data():
function test_delete_many_data (line 568) | def test_delete_many_data():
function test_post_redirect_get_data (line 657) | def test_post_redirect_get_data():
function test_upsert_one (line 720) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_patch_many_api.py
function test_create_many_and_patch_many (line 288) | def test_create_many_and_patch_many():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_patch_one_api.py
function test_create_one_and_patch_one (line 290) | def test_create_one_and_patch_one():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_post_redirect_get_api.py
function test_create_one_but_no_follow_redirect (line 138) | def test_create_one_but_no_follow_redirect():
function test_create_one_with_redirect (line 150) | def test_create_one_with_redirect():
function test_create_but_conflict (line 214) | def test_create_but_conflict():
function test_create_but_not_found_get_api (line 226) | def test_create_but_not_found_get_api():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_put_many_api.py
function test_create_many_and_update_many (line 288) | def test_create_many_and_update_many():
function test_create_many_and_update_many_but_not_found (line 390) | def test_create_many_and_update_many_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy/api_test/test_put_one_api.py
function test_create_one_and_update_one (line 127) | def test_create_one_and_update_one():
function test_create_one_and_update_one_but_not_found (line 211) | def test_create_one_and_update_one_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/__init__.py
function get_transaction_session (line 30) | async def get_transaction_session() -> AsyncSession:
class UntitledTable256 (line 35) | class UntitledTable256(Base):
function create_table (line 69) | async def create_table():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_create_many_api.py
function create_example_data (line 36) | def create_example_data():
function test_try_only_input_required_fields (line 49) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 66) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 96) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 126) | def test_try_input_without_conflict():
function test_update_specific_columns_when_conflict (line 147) | def test_update_specific_columns_when_conflict():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_create_one_api.py
function create_example_data (line 124) | def create_example_data():
function test_try_only_input_required_fields (line 137) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 152) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 178) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 203) | def test_try_input_without_conflict():
function test_update_specific_columns_when_conflict (line 221) | def test_update_specific_columns_when_conflict():
function test_try_input_with_conflict_but_missing_update_columns (line 386) | def test_try_input_with_conflict_but_missing_update_columns():
function test_try_input_with_conflict_but_unknown_update_columns (line 407) | def test_try_input_with_conflict_but_unknown_update_columns():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_delete_many_api.py
function test_create_many_and_delete_many (line 88) | def test_create_many_and_delete_many():
function test_create_many_and_delete_many_but_not_found (line 182) | def test_create_many_and_delete_many_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_delete_one_api.py
function test_create_one_and_delete_one (line 295) | def test_create_one_and_delete_one():
function test_create_one_and_delete_one_but_not_found (line 369) | def test_create_one_and_delete_one_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_get_many_api.py
function create_example_data (line 103) | def create_example_data(num=1, **kwargs):
function test_pagination_and_ording (line 139) | def test_pagination_and_ording():
function test_create_new_data_and_get_by_primary_key (line 157) | def test_create_new_data_and_get_by_primary_key():
function test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type_and_get_many (line 185) | def test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type...
function test_create_a_more_than_one_data_and_get_many_1 (line 351) | def test_create_a_more_than_one_data_and_get_many_1():
function test_create_a_more_than_one_data_and_get_many_2 (line 1670) | def test_create_a_more_than_one_data_and_get_many_2():
function test_get_many_with_ordering_unknown_column (line 1785) | def test_get_many_with_ordering_unknown_column():
function test_get_many_with_ordering_with_default_order (line 1794) | def test_get_many_with_ordering_with_default_order():
function test_get_many_with_ordering_with_ASC (line 1803) | def test_get_many_with_ordering_with_ASC():
function test_get_many_with_ordering_with_DESC (line 1812) | def test_get_many_with_ordering_with_DESC():
function test_get_many_with_unknown_order_tyoe (line 1821) | def test_get_many_with_unknown_order_tyoe():
function test_get_many_with_ordering_with_empty_input_list (line 1830) | def test_get_many_with_ordering_with_empty_input_list():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_get_one_api.py
function get_transaction_session (line 22) | async def get_transaction_session() -> AsyncSession:
function test_get_by_primary_key_without_any_query_param (line 88) | def test_get_by_primary_key_without_any_query_param():
function test_get_by_primary_key_with_false_bool_query_param (line 96) | def test_get_by_primary_key_with_false_bool_query_param():
function test_get_by_primary_key_with_false_char_query_param (line 105) | def test_get_by_primary_key_with_false_char_query_param():
function test_get_by_primary_key_with_false_float4_query_param (line 208) | def test_get_by_primary_key_with_false_float4_query_param():
function test_get_by_primary_key_with_false_float8_query_param (line 259) | def test_get_by_primary_key_with_false_float8_query_param():
function test_get_by_primary_key_with_false_int2_query_param (line 310) | def test_get_by_primary_key_with_false_int2_query_param():
function test_get_by_primary_key_with_false_int4_query_param (line 361) | def test_get_by_primary_key_with_false_int4_query_param():
function test_get_by_primary_key_with_false_int8_query_param (line 412) | def test_get_by_primary_key_with_false_int8_query_param():
function test_get_by_primary_key_with_false_numeric_query_param (line 464) | def test_get_by_primary_key_with_false_numeric_query_param():
function test_get_by_primary_key_with_false_text_query_param (line 515) | def test_get_by_primary_key_with_false_text_query_param():
function test_get_by_primary_key_with_false_uuid_query_param (line 617) | def test_get_by_primary_key_with_false_uuid_query_param():
function test_get_by_primary_key_with_false_varchar_query_param (line 658) | def test_get_by_primary_key_with_false_varchar_query_param():
function test_get_by_primary_key_with_false_date_range_query_param (line 760) | def test_get_by_primary_key_with_false_date_range_query_param():
function test_get_by_primary_key_with_false_time_range_query_param (line 810) | def test_get_by_primary_key_with_false_time_range_query_param():
function test_get_by_primary_key_with_false_timestamp_range_query_param (line 860) | def test_get_by_primary_key_with_false_timestamp_range_query_param():
function test_get_by_primary_key_with_false_timetz_range_query_param (line 919) | def test_get_by_primary_key_with_false_timetz_range_query_param():
function test_get_by_primary_key_with_false_timestamptz_range_query_param (line 971) | def test_get_by_primary_key_with_false_timestamptz_range_query_param():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_other_default_value.py
function get_transaction_session (line 41) | async def get_transaction_session() -> AsyncSession:
class UUIDTable (line 49) | class UUIDTable(Base):
function setup_module (line 79) | def setup_module(module):
function test_get_one_data_and_create_one_data (line 138) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 157) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 174) | def test_update_one_data():
function test_update_many_data (line 201) | def test_update_many_data():
function test_patch_one_data (line 302) | def test_patch_one_data():
function test_patch_many_data (line 409) | def test_patch_many_data():
function test_delete_one_data (line 514) | def test_delete_one_data():
function test_delete_many_data (line 586) | def test_delete_many_data():
function test_post_redirect_get_data (line 675) | def test_post_redirect_get_data():
function test_upsert_one (line 737) | def test_upsert_one():
function test_upsert_one (line 762) | def test_upsert_one():
function teardown_module (line 787) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_other_single_unique.py
function get_transaction_session (line 41) | async def get_transaction_session() -> AsyncSession:
class UUIDTable (line 47) | class UUIDTable(Base):
function setup_module (line 73) | def setup_module(module):
function test_get_one_data_and_create_one_data (line 136) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 155) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 172) | def test_update_one_data():
function test_update_many_data (line 198) | def test_update_many_data():
function test_patch_one_data (line 299) | def test_patch_one_data():
function test_patch_many_data (line 405) | def test_patch_many_data():
function test_delete_one_data (line 508) | def test_delete_one_data():
function test_delete_many_data (line 580) | def test_delete_many_data():
function test_post_redirect_get_data (line 668) | def test_post_redirect_get_data():
function test_upsert_one (line 731) | def test_upsert_one():
function teardown_module (line 756) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_other_uuid_primary.py
function get_transaction_session (line 41) | async def get_transaction_session() -> AsyncSession:
class UUIDTable (line 46) | class UUIDTable(Base):
function create_table (line 78) | async def create_table():
function test_get_one_data_and_create_one_data (line 137) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 156) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 173) | def test_update_one_data():
function test_update_many_data (line 199) | def test_update_many_data():
function test_patch_one_data (line 299) | def test_patch_one_data():
function test_patch_many_data (line 405) | def test_patch_many_data():
function test_delete_one_data (line 509) | def test_delete_one_data():
function test_delete_many_data (line 581) | def test_delete_many_data():
function test_post_redirect_get_data (line 670) | def test_post_redirect_get_data():
function test_upsert_one (line 733) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_patch_many_api.py
function test_create_many_and_patch_many (line 295) | def test_create_many_and_patch_many():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_patch_one_api.py
function test_create_one_and_patch_one (line 295) | def test_create_one_and_patch_one():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_post_redirect_get_api.py
function get_transaction_session (line 24) | async def get_transaction_session() -> AsyncSession:
function test_create_one_but_no_follow_redirect (line 78) | def test_create_one_but_no_follow_redirect():
function test_create_one_with_redirect (line 90) | def test_create_one_with_redirect():
function test_create_but_conflict (line 154) | def test_create_but_conflict():
function test_create_but_not_found_get_api (line 166) | def test_create_but_not_found_get_api():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_put_many_api.py
function test_create_many_and_update_many (line 294) | def test_create_many_and_update_many():
function test_create_many_and_update_many_but_not_found (line 401) | def test_create_many_and_update_many_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy/api_test_async/test_put_one_api.py
function get_session (line 22) | async def get_session() -> AsyncSession:
function test_create_one_and_update_one (line 108) | def test_create_one_and_update_one():
function test_create_one_and_update_one_but_not_found (line 194) | def test_create_one_and_update_one_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_create_null_type.py
class UntitledTable256 (line 14) | class UntitledTable256(Base):
function get_transaction_session (line 55) | def get_transaction_session():
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_create_table_with_more_than_one_unique_but_no_use_composite.py
function get_transaction_session (line 49) | def get_transaction_session():
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_use_blob_type_column.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
function get_transaction_session (line 54) | def get_transaction_session():
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_use_composite_primary.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_use_more_than_one_pk.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_use_more_than_one_unique.py
class UntitledTable256 (line 11) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_use_unique_and_composite_unique.py
class UntitledTable256 (line 11) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_use_unsupported_type_pk.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_use_unsupported_type_pk_2.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_use_unsupported_type_pk_3.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy/error_test/test_use_unsupported_type_pk_4.py
class UntitledTable256 (line 12) | class UntitledTable256(Base):
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/__init__.py
function get_transaction_session (line 23) | def get_transaction_session():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_delete_many_api.py
function test_create_many_and_delete_many (line 68) | def test_create_many_and_delete_many():
function test_create_many_and_delete_many_but_not_found (line 161) | def test_create_many_and_delete_many_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_delete_one_api.py
function test_create_one_and_delete_one (line 70) | def test_create_one_and_delete_one():
function test_create_one_and_delete_one_but_not_found (line 147) | def test_create_one_and_delete_one_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_get_many_api.py
function create_example_data (line 45) | def create_example_data(num=1, **kwargs):
function test_pagination_and_ording (line 81) | def test_pagination_and_ording():
function test_create_new_data_and_get_by_primary_key (line 99) | def test_create_new_data_and_get_by_primary_key():
function test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type_and_get_many (line 127) | def test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type...
function test_create_a_more_than_one_data_and_get_many_1 (line 293) | def test_create_a_more_than_one_data_and_get_many_1():
function test_create_a_more_than_one_data_and_get_many_2 (line 1612) | def test_create_a_more_than_one_data_and_get_many_2():
function test_get_many_with_ordering_unknown_column (line 1725) | def test_get_many_with_ordering_unknown_column():
function test_get_many_with_ordering_with_default_order (line 1734) | def test_get_many_with_ordering_with_default_order():
function test_get_many_with_ordering_with_ASC (line 1743) | def test_get_many_with_ordering_with_ASC():
function test_get_many_with_ordering_with_DESC (line 1752) | def test_get_many_with_ordering_with_DESC():
function test_get_many_with_unknown_order_tyoe (line 1762) | def test_get_many_with_unknown_order_tyoe():
function test_get_many_with_ordering_with_empty_input_list (line 1771) | def test_get_many_with_ordering_with_empty_input_list():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_get_one_api.py
function test_get_by_primary_key_without_any_query_param (line 66) | def test_get_by_primary_key_without_any_query_param():
function test_get_by_primary_key_with_false_bool_query_param (line 74) | def test_get_by_primary_key_with_false_bool_query_param():
function test_get_by_primary_key_with_false_char_query_param (line 83) | def test_get_by_primary_key_with_false_char_query_param():
function test_get_by_primary_key_with_false_float4_query_param (line 186) | def test_get_by_primary_key_with_false_float4_query_param():
function test_get_by_primary_key_with_false_float8_query_param (line 237) | def test_get_by_primary_key_with_false_float8_query_param():
function test_get_by_primary_key_with_false_int2_query_param (line 288) | def test_get_by_primary_key_with_false_int2_query_param():
function test_get_by_primary_key_with_false_int4_query_param (line 339) | def test_get_by_primary_key_with_false_int4_query_param():
function test_get_by_primary_key_with_false_int8_query_param (line 390) | def test_get_by_primary_key_with_false_int8_query_param():
function test_get_by_primary_key_with_false_numeric_query_param (line 442) | def test_get_by_primary_key_with_false_numeric_query_param():
function test_get_by_primary_key_with_false_text_query_param (line 493) | def test_get_by_primary_key_with_false_text_query_param():
function test_get_by_primary_key_with_false_uuid_query_param (line 595) | def test_get_by_primary_key_with_false_uuid_query_param():
function test_get_by_primary_key_with_false_varchar_query_param (line 636) | def test_get_by_primary_key_with_false_varchar_query_param():
function test_get_by_primary_key_with_false_date_range_query_param (line 738) | def test_get_by_primary_key_with_false_date_range_query_param():
function test_get_by_primary_key_with_false_time_range_query_param (line 788) | def test_get_by_primary_key_with_false_time_range_query_param():
function test_get_by_primary_key_with_false_timestamp_range_query_param (line 838) | def test_get_by_primary_key_with_false_timestamp_range_query_param():
function test_get_by_primary_key_with_false_timetz_range_query_param (line 897) | def test_get_by_primary_key_with_false_timetz_range_query_param():
function test_get_by_primary_key_with_false_timestamptz_range_query_param (line 949) | def test_get_by_primary_key_with_false_timestamptz_range_query_param():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_other_no_alias.py
function get_transaction_session (line 33) | def get_transaction_session():
function test_get_one_data_and_create_one_data (line 118) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 137) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 154) | def test_update_one_data():
function test_update_many_data (line 180) | def test_update_many_data():
function test_patch_one_data (line 281) | def test_patch_one_data():
function test_patch_many_data (line 387) | def test_patch_many_data():
function test_delete_one_data (line 491) | def test_delete_one_data():
function test_delete_many_data (line 563) | def test_delete_many_data():
function test_post_redirect_get_data (line 652) | def test_post_redirect_get_data():
function test_upsert_one (line 714) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_other_set_description.py
function get_transaction_session (line 33) | def get_transaction_session():
function test_get_one_data_and_create_one_data (line 118) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 137) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 154) | def test_update_one_data():
function test_update_many_data (line 181) | def test_update_many_data():
function test_patch_one_data (line 282) | def test_patch_one_data():
function test_patch_many_data (line 389) | def test_patch_many_data():
function test_delete_one_data (line 494) | def test_delete_one_data():
function test_delete_many_data (line 566) | def test_delete_many_data():
function test_post_redirect_get_data (line 655) | def test_post_redirect_get_data():
function test_upsert_one (line 717) | def test_upsert_one():
function test_upsert_one (line 742) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_other_single_unique.py
function get_transaction_session (line 33) | def get_transaction_session():
function test_get_one_data_and_create_one_data (line 118) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 137) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 154) | def test_update_one_data():
function test_update_many_data (line 180) | def test_update_many_data():
function test_patch_one_data (line 282) | def test_patch_one_data():
function test_patch_many_data (line 388) | def test_patch_many_data():
function test_delete_one_data (line 491) | def test_delete_one_data():
function test_delete_many_data (line 563) | def test_delete_many_data():
function test_post_redirect_get_data (line 651) | def test_post_redirect_get_data():
function test_upsert_one (line 713) | def test_upsert_one():
function teardown_module (line 738) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_other_user_default_value.py
function get_transaction_session (line 33) | def get_transaction_session():
function test_get_one_data_and_create_one_data (line 118) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 137) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 154) | def test_update_one_data():
function test_update_many_data (line 181) | def test_update_many_data():
function test_patch_one_data (line 282) | def test_patch_one_data():
function test_patch_many_data (line 389) | def test_patch_many_data():
function test_delete_one_data (line 494) | def test_delete_one_data():
function test_delete_many_data (line 566) | def test_delete_many_data():
function test_post_redirect_get_data (line 655) | def test_post_redirect_get_data():
function test_upsert_one (line 717) | def test_upsert_one():
function test_upsert_one (line 742) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_other_uuid_primary.py
function get_transaction_session (line 33) | def get_transaction_session():
function setup_module (line 69) | def setup_module(module):
function test_get_one_data_and_create_one_data (line 121) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 140) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 157) | def test_update_one_data():
function test_update_many_data (line 183) | def test_update_many_data():
function test_patch_one_data (line 284) | def test_patch_one_data():
function test_patch_many_data (line 390) | def test_patch_many_data():
function test_delete_one_data (line 494) | def test_delete_one_data():
function test_delete_many_data (line 566) | def test_delete_many_data():
function test_post_redirect_get_data (line 655) | def test_post_redirect_get_data():
function test_upsert_one (line 717) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_patch_many_api.py
function test_create_many_and_patch_many (line 77) | def test_create_many_and_patch_many():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_patch_one_api.py
function test_create_one_and_patch_one (line 78) | def test_create_one_and_patch_one():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_post_redirect_get_api.py
function test_create_one_but_no_follow_redirect (line 56) | def test_create_one_but_no_follow_redirect():
function test_create_one_with_redirect (line 68) | def test_create_one_with_redirect():
function test_create_but_conflict (line 132) | def test_create_but_conflict():
function test_create_but_not_found_get_api (line 144) | def test_create_but_not_found_get_api():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_put_many_api.py
function test_create_many_and_update_many (line 78) | def test_create_many_and_update_many():
function test_create_many_and_update_many_but_not_found (line 180) | def test_create_many_and_update_many_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_put_one_api.py
function test_create_one_and_update_one (line 79) | def test_create_one_and_update_one():
function test_create_one_and_update_one_but_not_found (line 163) | def test_create_one_and_update_one_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_upsert_many_api.py
function create_example_data (line 35) | def create_example_data():
function test_try_only_input_required_fields (line 48) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 65) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 95) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 125) | def test_try_input_without_conflict():
function test_update_specific_columns_when_conflict (line 146) | def test_update_specific_columns_when_conflict():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test/test_upsert_one_api.py
function create_example_data (line 64) | def create_example_data():
function test_try_only_input_required_fields (line 77) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 92) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 118) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 143) | def test_try_input_without_conflict():
function test_update_specific_columns_when_conflict (line 161) | def test_update_specific_columns_when_conflict():
function test_try_input_with_conflict_but_missing_update_columns (line 326) | def test_try_input_with_conflict_but_missing_update_columns():
function test_try_input_with_conflict_but_unknown_update_columns (line 347) | def test_try_input_with_conflict_but_unknown_update_columns():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/__init__.py
function get_transaction_session (line 34) | async def get_transaction_session() -> AsyncSession:
function create_table (line 68) | async def create_table():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_create_many_api.py
function create_example_data (line 36) | def create_example_data():
function test_try_only_input_required_fields (line 49) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 66) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 96) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 126) | def test_try_input_without_conflict():
function test_update_specific_columns_when_conflict (line 147) | def test_update_specific_columns_when_conflict():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_create_one_api.py
function create_example_data (line 71) | def create_example_data():
function test_try_only_input_required_fields (line 84) | def test_try_only_input_required_fields():
function test_try_input_with_conflict_but_conflict_columns_not_hit (line 99) | def test_try_input_with_conflict_but_conflict_columns_not_hit():
function test_try_input_with_conflict (line 125) | def test_try_input_with_conflict():
function test_try_input_without_conflict (line 150) | def test_try_input_without_conflict():
function test_update_specific_columns_when_conflict (line 168) | def test_update_specific_columns_when_conflict():
function test_try_input_with_conflict_but_missing_update_columns (line 334) | def test_try_input_with_conflict_but_missing_update_columns():
function test_try_input_with_conflict_but_unknown_update_columns (line 355) | def test_try_input_with_conflict_but_unknown_update_columns():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_delete_many_api.py
function test_create_many_and_delete_many (line 78) | def test_create_many_and_delete_many():
function test_create_many_and_delete_many_but_not_found (line 170) | def test_create_many_and_delete_many_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_delete_one_api.py
function test_create_one_and_delete_one (line 76) | def test_create_one_and_delete_one():
function test_create_one_and_delete_one_but_not_found (line 153) | def test_create_one_and_delete_one_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_get_many_api.py
function create_example_data (line 48) | def create_example_data(num=1, **kwargs):
function test_pagination_and_ording (line 84) | def test_pagination_and_ording():
function test_create_new_data_and_get_by_primary_key (line 102) | def test_create_new_data_and_get_by_primary_key():
function test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type_and_get_many (line 130) | def test_create_a_more_than_one_data_which_value_is_TRUE_of_boolean_type...
function test_create_a_more_than_one_data_and_get_many_1 (line 296) | def test_create_a_more_than_one_data_and_get_many_1():
function test_create_a_more_than_one_data_and_get_many_2 (line 1615) | def test_create_a_more_than_one_data_and_get_many_2():
function test_get_many_with_ordering_unknown_column (line 1728) | def test_get_many_with_ordering_unknown_column():
function test_get_many_with_ordering_with_default_order (line 1737) | def test_get_many_with_ordering_with_default_order():
function test_get_many_with_ordering_with_ASC (line 1746) | def test_get_many_with_ordering_with_ASC():
function test_get_many_with_ordering_with_DESC (line 1755) | def test_get_many_with_ordering_with_DESC():
function test_get_many_with_unknown_order_tyoe (line 1764) | def test_get_many_with_unknown_order_tyoe():
function test_get_many_with_ordering_with_empty_input_list (line 1773) | def test_get_many_with_ordering_with_empty_input_list():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_get_one_api.py
function get_session (line 23) | async def get_session() -> AsyncSession:
function test_get_by_primary_key_without_any_query_param (line 82) | def test_get_by_primary_key_without_any_query_param():
function test_get_by_primary_key_with_false_bool_query_param (line 90) | def test_get_by_primary_key_with_false_bool_query_param():
function test_get_by_primary_key_with_false_char_query_param (line 98) | def test_get_by_primary_key_with_false_char_query_param():
function test_get_by_primary_key_with_false_float4_query_param (line 199) | def test_get_by_primary_key_with_false_float4_query_param():
function test_get_by_primary_key_with_false_float8_query_param (line 248) | def test_get_by_primary_key_with_false_float8_query_param():
function test_get_by_primary_key_with_false_int2_query_param (line 297) | def test_get_by_primary_key_with_false_int2_query_param():
function test_get_by_primary_key_with_false_int4_query_param (line 346) | def test_get_by_primary_key_with_false_int4_query_param():
function test_get_by_primary_key_with_false_int8_query_param (line 395) | def test_get_by_primary_key_with_false_int8_query_param():
function test_get_by_primary_key_with_false_numeric_query_param (line 445) | def test_get_by_primary_key_with_false_numeric_query_param():
function test_get_by_primary_key_with_false_text_query_param (line 494) | def test_get_by_primary_key_with_false_text_query_param():
function test_get_by_primary_key_with_false_uuid_query_param (line 552) | def test_get_by_primary_key_with_false_uuid_query_param():
function test_get_by_primary_key_with_false_varchar_query_param (line 576) | def test_get_by_primary_key_with_false_varchar_query_param():
function test_get_by_primary_key_with_false_date_range_query_param (line 634) | def test_get_by_primary_key_with_false_date_range_query_param():
function test_get_by_primary_key_with_false_time_range_query_param (line 672) | def test_get_by_primary_key_with_false_time_range_query_param():
function test_get_by_primary_key_with_false_timestamp_range_query_param (line 711) | def test_get_by_primary_key_with_false_timestamp_range_query_param():
function test_get_by_primary_key_with_false_timetz_range_query_param (line 754) | def test_get_by_primary_key_with_false_timetz_range_query_param():
function test_get_by_primary_key_with_false_timestamptz_range_query_param (line 794) | def test_get_by_primary_key_with_false_timestamptz_range_query_param():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_other_default_value.py
function get_transaction_session (line 41) | async def get_transaction_session() -> AsyncSession:
function setup_module (line 75) | def setup_module(module):
function test_get_one_data_and_create_one_data (line 134) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 153) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 170) | def test_update_one_data():
function test_update_many_data (line 197) | def test_update_many_data():
function test_patch_one_data (line 298) | def test_patch_one_data():
function test_patch_many_data (line 405) | def test_patch_many_data():
function test_delete_one_data (line 510) | def test_delete_one_data():
function test_delete_many_data (line 582) | def test_delete_many_data():
function test_post_redirect_get_data (line 671) | def test_post_redirect_get_data():
function test_upsert_one (line 733) | def test_upsert_one():
function test_upsert_one (line 758) | def test_upsert_one():
function teardown_module (line 783) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_other_no_alias.py
function get_transaction_session (line 43) | async def get_transaction_session() -> AsyncSession:
function setup_module (line 76) | def setup_module(module):
function test_get_one_data_and_create_one_data (line 136) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 155) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 172) | def test_update_one_data():
function test_update_many_data (line 198) | def test_update_many_data():
function test_patch_one_data (line 298) | def test_patch_one_data():
function test_patch_many_data (line 404) | def test_patch_many_data():
function test_delete_one_data (line 508) | def test_delete_one_data():
function test_delete_many_data (line 580) | def test_delete_many_data():
function test_post_redirect_get_data (line 669) | def test_post_redirect_get_data():
function test_upsert_one (line 732) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_other_single_unique.py
function get_transaction_session (line 44) | async def get_transaction_session() -> AsyncSession:
function setup_module (line 76) | def setup_module(module):
function test_get_one_data_and_create_one_data (line 137) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 156) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 173) | def test_update_one_data():
function test_update_many_data (line 199) | def test_update_many_data():
function test_patch_one_data (line 300) | def test_patch_one_data():
function test_patch_many_data (line 406) | def test_patch_many_data():
function test_delete_one_data (line 509) | def test_delete_one_data():
function test_delete_many_data (line 581) | def test_delete_many_data():
function test_post_redirect_get_data (line 669) | def test_post_redirect_get_data():
function test_upsert_one (line 732) | def test_upsert_one():
function teardown_module (line 757) | def teardown_module(module):
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_other_uuid_primary.py
function get_transaction_session (line 43) | async def get_transaction_session() -> AsyncSession:
function setup_module (line 76) | def setup_module(module):
function test_get_one_data_and_create_one_data (line 136) | def test_get_one_data_and_create_one_data():
function test_get_many_data_and_create_many_data (line 155) | def test_get_many_data_and_create_many_data():
function test_update_one_data (line 172) | def test_update_one_data():
function test_update_many_data (line 198) | def test_update_many_data():
function test_patch_one_data (line 298) | def test_patch_one_data():
function test_patch_many_data (line 404) | def test_patch_many_data():
function test_delete_one_data (line 508) | def test_delete_one_data():
function test_delete_many_data (line 580) | def test_delete_many_data():
function test_post_redirect_get_data (line 669) | def test_post_redirect_get_data():
function test_upsert_one (line 732) | def test_upsert_one():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_patch_many_api.py
function test_create_many_and_patch_many (line 255) | def test_create_many_and_patch_many():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_patch_one_api.py
function test_create_one_and_patch_one (line 239) | def test_create_one_and_patch_one():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_post_redirect_get_api.py
function test_create_one_but_no_follow_redirect (line 87) | def test_create_one_but_no_follow_redirect():
function test_create_one_with_redirect (line 99) | def test_create_one_with_redirect():
function test_create_but_conflict (line 163) | def test_create_but_conflict():
function test_create_but_not_found_get_api (line 175) | def test_create_but_not_found_get_api():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_put_many_api.py
function test_create_many_and_update_many (line 182) | def test_create_many_and_update_many():
function test_create_many_and_update_many_but_not_found (line 289) | def test_create_many_and_update_many_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy_table/api_test_async/test_put_one_api.py
function test_create_one_and_update_one (line 108) | def test_create_one_and_update_one():
function test_create_one_and_update_one_but_not_found (line 195) | def test_create_one_and_update_one_but_not_found():
FILE: tests/test_implementations/test_sqlalchemy_table/error_test/test_create_null_type.py
function get_transaction_session (line 53) | def get_transaction_session():
FILE: tests/test_implementations/test_sqlalchemy_table/error_test/test_use_unsupported_type_2.py
function get_transaction_session (line 53) | def get_transaction_session():
FILE: tests/test_implementations/test_sqlalchemy_table/error_test/test_use_unsupported_type_3.py
function get_transaction_session (line 53) | def get_transaction_session():
FILE: tests/test_implementations/test_sqlalchemy_table/error_test/test_use_unsupported_type_4.py
function get_transaction_session (line 53) | def get_transaction_session():
FILE: tutorial/__init__.py
function test (line 77) | def test(*args, **kwargs):
FILE: tutorial/basic_usage/depencies_example_auth.py
function get_transaction_session (line 27) | def get_transaction_session():
class ExampleTable (line 35) | class ExampleTable(Base):
function AuthenticationService (line 69) | def AuthenticationService(
FILE: tutorial/basic_usage/quick_usage_with_async_SQLALchemy_Base.py
function get_transaction_session (line 24) | async def get_transaction_session() -> AsyncSession:
class ExampleTable (line 30) | class ExampleTable(Base):
function startup_event (line 124) | async def startup_event():
FILE: tutorial/basic_usage/quick_usage_with_async_SQLALchemy_table.py
function get_transaction_session (line 26) | async def get_transaction_session() -> AsyncSession:
function startup_event (line 118) | async def startup_event():
FILE: tutorial/basic_usage/quick_usage_with_async_SQLALchemy_table_with_out_primary_key.py
function get_transaction_session (line 26) | async def get_transaction_session() -> AsyncSession:
function startup_event (line 100) | async def startup_event():
FILE: tutorial/basic_usage/quick_usage_with_sync_SQLAlchemy_Base.py
function get_transaction_session (line 24) | def get_transaction_session():
class ExampleTable (line 36) | class ExampleTable(Base):
FILE: tutorial/foreign_tree/async_m2m.py
function get_transaction_session (line 33) | async def get_transaction_session():
class Child (line 49) | class Child(Base):
class Parent (line 57) | class Parent(Base):
class ChildSecond (line 67) | class ChildSecond(Base):
function create_table (line 145) | async def create_table():
FILE: tutorial/foreign_tree/m2m.py
function get_transaction_session (line 17) | def get_transaction_session():
class Child (line 36) | class Child(Base):
class Parent (line 44) | class Parent(Base):
class ChildSecond (line 54) | class ChildSecond(Base):
FILE: tutorial/foreign_tree/sample_tree.py
class Account (line 11) | class Account(Base):
class BlogPost (line 17) | class BlogPost(Base):
class BlogComment (line 25) | class BlogComment(Base):
FILE: tutorial/relationship/many_to_many.py
class Parent (line 27) | class Parent(Base):
class Child (line 34) | class Child(Base):
function my_api (line 106) | async def my_api(
FILE: tutorial/relationship/many_to_one.py
function get_transaction_session (line 27) | async def get_transaction_session() -> AsyncSession:
class Child (line 39) | class Child(Base):
class Parent (line 42) | class Parent(Base):
function startup_event (line 49) | async def startup_event():
FILE: tutorial/relationship/one_to_many.py
function get_transaction_session (line 27) | async def get_transaction_session() -> AsyncSession:
class Parent (line 41) | class Parent(Base):
class Child (line 46) | class Child(Base):
function startup_event (line 53) | async def startup_event():
FILE: tutorial/relationship/one_to_one.py
function get_transaction_session (line 22) | async def get_transaction_session() -> AsyncSession:
class Parent (line 33) | class Parent(Base):
class Child (line 40) | class Child(Base):
function startup_event (line 49) | async def startup_event():
FILE: tutorial/sample.py
class Parent (line 7) | class Parent(Base):
class Child (line 15) | class Child(Base):
function root (line 38) | async def root():
FILE: tutorial/sample_case.py
class User (line 10) | class User(Base):
FILE: tutorial/sample_two_table.py
function get_transaction_session (line 19) | async def get_transaction_session() -> AsyncSession:
class Category (line 36) | class Category(Base):
class DataRestCachingCompOption (line 56) | class DataRestCachingCompOption(Base):
class DataRestCachingFilterOption (line 66) | class DataRestCachingFilterOption(Base):
class DataRestCachingQueryOption (line 76) | class DataRestCachingQueryOption(Base):
class EquipmentTypeNew (line 120) | class EquipmentTypeNew(Base):
class EquipmentType (line 133) | class EquipmentType(Base):
class Example (line 142) | class Example(Base):
class ExampleTable (line 153) | class ExampleTable(Base):
class FunctionGroup (line 222) | class FunctionGroup(Base):
class Movie (line 246) | class Movie(Base):
class ProcessedFilter (line 253) | class ProcessedFilter(Base):
class ProcessedResolution (line 261) | class ProcessedResolution(Base):
class ProcessedValue (line 269) | class ProcessedValue(Base):
class RefCode (line 284) | class RefCode(Base):
class RefFilter (line 296) | class RefFilter(Base):
class RefResolution (line 309) | class RefResolution(Base):
class RefSymptomGroup (line 321) | class RefSymptomGroup(Base):
class RelationshipTestA (line 331) | class RelationshipTestA(Base):
class Sometable (line 339) | class Sometable(Base):
class TempSite (line 350) | class TempSite(Base):
class Tenant (line 367) | class Tenant(Base):
class TestAliasUniqueColumn (line 381) | class TestAliasUniqueColumn(Base):
class TestAliasUniqueColumnAsync (line 411) | class TestAliasUniqueColumnAsync(Base):
class TestBuildMyself (line 441) | class TestBuildMyself(Base):
class TestBuildMyselfAsync (line 472) | class TestBuildMyselfAsync(Base):
class TestNoAlia (line 503) | class TestNoAlia(Base):
class TestNoAliasAsync (line 533) | class TestNoAliasAsync(Base):
class TestTable (line 563) | class TestTable(Base):
class TestUuidPrimary (line 595) | class TestUuidPrimary(Base):
class TestUuidPrimaryAsync (line 625) | class TestUuidPrimaryAsync(Base):
class TestUuidPrimarySync (line 655) | class TestUuidPrimarySync(Base):
class ZFaultDiagnosisType (line 746) | class ZFaultDiagnosisType(Base):
class FaultFeatureTypeNew (line 759) | class FaultFeatureTypeNew(Base):
class FaultFeatureType (line 778) | class FaultFeatureType(Base):
class FaultSymptomType (line 794) | class FaultSymptomType(Base):
class Function (line 812) | class Function(Base):
class Site (line 838) | class Site(Base):
class TenantPolicy (line 858) | class TenantPolicy(Base):
class UserGroup (line 872) | class UserGroup(Base):
class User (line 888) | class User(Base):
class WidgetInfo (line 906) | class WidgetInfo(Base):
class Dashboard (line 960) | class Dashboard(Base):
class DataRestCachingPayload (line 982) | class DataRestCachingPayload(Base):
class Device (line 1002) | class Device(Base):
class FaultDiagnosi (line 1018) | class FaultDiagnosi(Base):
class FaultFeatureNew (line 1041) | class FaultFeatureNew(Base):
class FaultSymptom (line 1056) | class FaultSymptom(Base):
class FaultFeature (line 1102) | class FaultFeature(Base):
class UserDashboard (line 1114) | class UserDashboard(Base):
class WidgetLayout (line 1135) | class WidgetLayout(Base):
class UntitledTable256 (line 1165) | class UntitledTable256(Base):
method test (line 1198) | def test(self):
class Child (line 1213) | class Child(Base):
class Parent (line 1218) | class Parent(Base):
class ChildSecond (line 1227) | class ChildSecond(Base):
Condensed preview — 212 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,223K chars).
[
{
"path": ".coveragerc",
"chars": 1724,
"preview": "\n[report]\nshow_missing = True\nomit =\n /usr/*\n venv/*\n tests/*\n src/fastapi_quickcrud/misc/abstract_execute.p"
},
{
"path": ".github/workflows/ci.yml",
"chars": 5645,
"preview": "# This is a basic workflow to help you get started with Actions\n\nname: Unit testing in 🐍3.7/8/9/10\n\n# Controls when the "
},
{
"path": ".github/workflows/coverage.yml",
"chars": 1793,
"preview": "# This is a basic workflow to help you get started with Actions\n\nname: Coverage\n\n# Controls when the workflow will run\no"
},
{
"path": ".github/workflows/release.yml",
"chars": 6489,
"preview": "# This is a basic workflow to help you get started with Actions\n\nname: Publish Python 🐍 distributions 📦 to PyPI\n\non:\n p"
},
{
"path": ".gitignore",
"chars": 212,
"preview": "/htmlcov/\n.coverage\ntests/htmlcov\n/poetry.lock\n/pyproject.toml\n*.xml\n*.pyc\nworkspace.xml\n*.iml\n*.xml\n*.sh\n*.gz\n*.txt\n*.\n"
},
{
"path": "CHANGELOG.md",
"chars": 3641,
"preview": "\n# Change Log\nAll notable changes to this project will be documented in this file.\n\n\n\n## [not release] - 2021-09-27\n \n##"
},
{
"path": "LICENSE",
"chars": 1065,
"preview": "MIT License\n\nCopyright (c) 2021 Luis Lui\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\no"
},
{
"path": "README.md",
"chars": 22447,
"preview": "# FastAPI Quick CRUD\n\n\n\n[\n\n[ or os.geten"
},
{
"path": "src/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "src/fastapi_quickcrud/__init__.py",
"chars": 129,
"preview": "from .misc.utils import sqlalchemy_to_pydantic\nfrom .crud_router import crud_router_builder\nfrom .misc.type import CrudM"
},
{
"path": "src/fastapi_quickcrud/crud_router.py",
"chars": 23578,
"preview": "import asyncio\nimport inspect\nfrom functools import partial\nfrom typing import \\\n Any, \\\n List, \\\n TypeVar, Uni"
},
{
"path": "src/fastapi_quickcrud/misc/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "src/fastapi_quickcrud/misc/abstract_execute.py",
"chars": 1225,
"preview": "from typing import Any\n\nfrom sqlalchemy.sql.elements import BinaryExpression\n\n\nclass SQLALchemyExecuteService(object):\n\n"
},
{
"path": "src/fastapi_quickcrud/misc/abstract_parser.py",
"chars": 17637,
"preview": "import copy\nfrom http import HTTPStatus\nfrom urllib.parse import urlencode\nfrom pydantic import parse_obj_as\nfrom starle"
},
{
"path": "src/fastapi_quickcrud/misc/abstract_query.py",
"chars": 16926,
"preview": "from abc import ABC\nfrom typing import List, Union\n\nfrom sqlalchemy import and_, select, text\nfrom sqlalchemy.dialects.p"
},
{
"path": "src/fastapi_quickcrud/misc/abstract_route.py",
"chars": 61001,
"preview": "from abc import abstractmethod, ABC\nfrom http import HTTPStatus\nfrom typing import Union\n\nfrom fastapi import \\\n Depe"
},
{
"path": "src/fastapi_quickcrud/misc/covert_model.py",
"chars": 746,
"preview": "from sqlalchemy.ext.declarative import declarative_base\n\nfrom sqlalchemy.sql.schema import Table\n\n\ndef convert_table_to_"
},
{
"path": "src/fastapi_quickcrud/misc/crud_model.py",
"chars": 1942,
"preview": "from typing import (Optional,\n Dict,\n List)\n\nfrom pydantic import BaseModel\nfrom p"
},
{
"path": "src/fastapi_quickcrud/misc/exceptions.py",
"chars": 1772,
"preview": "from fastapi import HTTPException\n\n\nclass FindOneApiNotRegister(HTTPException):\n pass\n\n\nclass CRUDBuilderException(Ba"
},
{
"path": "src/fastapi_quickcrud/misc/memory_sql.py",
"chars": 2811,
"preview": "import asyncio\nimport string\nimport random\nfrom typing import Generator\n\nfrom sqlalchemy import create_engine\nfrom sqlal"
},
{
"path": "src/fastapi_quickcrud/misc/schema_builder.py",
"chars": 96811,
"preview": "import uuid\nimport warnings\nfrom copy import deepcopy\nfrom dataclasses import (make_dataclass,\n "
},
{
"path": "src/fastapi_quickcrud/misc/type.py",
"chars": 4523,
"preview": "from enum import Enum, auto\nfrom itertools import chain\n\nfrom strenum import StrEnum\n\nfrom .exceptions import InvalidReq"
},
{
"path": "src/fastapi_quickcrud/misc/utils.py",
"chars": 14521,
"preview": "from itertools import groupby\nfrom typing import Type, List, Union, TypeVar, Optional\n\nfrom pydantic import BaseModel, B"
},
{
"path": "tests/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/conf/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/conf/config.py",
"chars": 1017,
"preview": "import os\nimport pathlib\n\n\nENV_FILE_PATH = pathlib.Path(__file__).parent / \"dev.env\"\nassert ENV_FILE_PATH.exists()\n\n\ncla"
},
{
"path": "tests/conf/dev.docker-compose.yml",
"chars": 144,
"preview": "version: \"3.9\"\n\nservices:\n db:\n image: postgres\n restart: always\n env_file:\n - dev.env\n po"
},
{
"path": "tests/conf/dev.env",
"chars": 109,
"preview": "POSTGRES_HOST=localhost\nPOSTGRES_DB=test\nPOSTGRES_USER=postgres\nPOSTGRES_PASSWORD=password\nPOSTGRES_PORT=5432"
},
{
"path": "tests/test_implementations/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/other/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/__init__.py",
"chars": 1869,
"preview": "import os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, "
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/foreign_tree/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/foreign_tree/test_relationship_m2m.py",
"chars": 25602,
"preview": "import asyncio\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey, Table, CHAR\nfrom s"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_create_many_api.py",
"chars": 4329,
"preview": "import json\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud import CrudMethods\nfrom src.fastapi"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_create_one_api.py",
"chars": 6435,
"preview": "import json\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud import sqlalchemy_to_pydantic\nfrom "
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_delete_many_api.py",
"chars": 13629,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\nfrom src.fastapi_quickcrud "
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_delete_one_api.py",
"chars": 11043,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_get_many_api.py",
"chars": 76027,
"preview": "import json\nfrom collections import OrderedDict\nfrom urllib.parse import urlencode\n\nfrom starlette.testclient import Tes"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_get_one_api.py",
"chars": 50823,
"preview": "import json\n\nfrom starlette.testclient import TestClient\n\n\nfrom src.fastapi_quickcrud.crud_router import crud_router_bui"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_other_default_value.py",
"chars": 32206,
"preview": "import json\nimport os\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfrom http impor"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_other_set_description.py",
"chars": 32451,
"preview": "import json\nimport os\nfrom datetime import datetime, timezone, date, timedelta\nfrom http import HTTPStatus\nfrom urllib.p"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_other_single_unique.py",
"chars": 33874,
"preview": "import json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfro"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_patch_many_api.py",
"chars": 9312,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_patch_one_api.py",
"chars": 10166,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_post_redirect_get_api.py",
"chars": 8452,
"preview": "import json\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\nfrom http import HTTPStatus\n\nfrom starl"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_put_many_api.py",
"chars": 14934,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_async_test/test_put_one_api.py",
"chars": 12257,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/__init__.py",
"chars": 1944,
"preview": "import os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, "
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/foreign_tree/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/foreign_tree/test_relationship_m2m.py",
"chars": 25137,
"preview": "from fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey, Table, CHAR\nfrom sqlalchemy.orm im"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_extra.py",
"chars": 3049,
"preview": "import json\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey, Table, String\nfrom sq"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2m.py",
"chars": 17955,
"preview": "from fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey, Table\nfrom sqlalchemy.orm import d"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2m_back_populates.py",
"chars": 17102,
"preview": "import os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey, Table\nfrom sqlalchemy.o"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2o.py",
"chars": 4432,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2o_back_populates.py",
"chars": 6202,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_m2o_back_refer.py",
"chars": 6477,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_o2m.py",
"chars": 5037,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_o2m_back_populates.py",
"chars": 5239,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_o2m_back_ref.py",
"chars": 4813,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/join_relationship/test_relationship_o2o.py",
"chars": 5328,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_create_many_api.py",
"chars": 4329,
"preview": "import json\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud import CrudMethods\nfrom src.fastapi"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_create_one_api.py",
"chars": 7227,
"preview": "import json\nimport random\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\n\nfrom starlette.testclien"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_delete_many_api.py",
"chars": 10718,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_delete_one_api.py",
"chars": 10728,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_get_many_api.py",
"chars": 75826,
"preview": "import json\nfrom collections import OrderedDict\nfrom urllib.parse import urlencode\n\nfrom starlette.testclient import Tes"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_get_one_api.py",
"chars": 51005,
"preview": "import json\n\nfrom starlette.testclient import TestClient\n\n\nfrom src.fastapi_quickcrud.crud_router import crud_router_bui"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_other_default_value.py",
"chars": 32009,
"preview": "import json\nimport os\nfrom datetime import datetime, timezone, date, timedelta\nfrom http import HTTPStatus\nfrom urllib.p"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_other_set_description.py",
"chars": 33538,
"preview": "import json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfro"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_other_single_unique.py",
"chars": 33856,
"preview": "import json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfro"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_patch_many_api.py",
"chars": 9207,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_patch_one_api.py",
"chars": 10061,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_post_redirect_get_api.py",
"chars": 8389,
"preview": "import json\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\nfrom http import HTTPStatus\n\nfrom starl"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_put_many_api.py",
"chars": 14829,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/api_test/test_put_one_api.py",
"chars": 12152,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_create_null_type.py",
"chars": 2433,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_create_specific_api_when_no_pk.py",
"chars": 4281,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_create_table_with_more_than_one_unique_but_no_use_composite.py",
"chars": 2351,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_blob_type_column.py",
"chars": 2411,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_composite_primary.py",
"chars": 2486,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_more_than_one_pk.py",
"chars": 2435,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_more_than_one_unique.py",
"chars": 2584,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unique_and_composite_unique.py",
"chars": 2600,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unsupported_type_pk.py",
"chars": 2409,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unsupported_type_pk_2.py",
"chars": 2406,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unsupported_type_pk_3.py",
"chars": 2402,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_memory_sqlalchemy/error_test/test_use_unsupported_type_pk_4.py",
"chars": 2403,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/__init__.py",
"chars": 2522,
"preview": "import os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, "
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2m.py",
"chars": 17046,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey, Table, inse"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2m_back_populates.py",
"chars": 18122,
"preview": "import os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey, Table\nfrom sqlalchemy.o"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2o.py",
"chars": 4387,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2o_back_populates.py",
"chars": 6534,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_m2o_back_refer.py",
"chars": 6433,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_o2m.py",
"chars": 4992,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_o2m_back_populates.py",
"chars": 5194,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_o2m_back_ref.py",
"chars": 5095,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/join_relationship/test_relationship_o2o.py",
"chars": 6184,
"preview": "import json\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import Column, Integer, \\\n ForeignKey\nfrom sqlalch"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_create_many_api.py",
"chars": 15033,
"preview": "import json\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\n\nfrom starlette.testclient import TestC"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_create_one_api.py",
"chars": 14914,
"preview": "import json\nimport random\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\n\nfrom starlette.testclien"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_delete_many_api.py",
"chars": 19782,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\nfrom src.fastapi_quickcrud "
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_delete_one_api.py",
"chars": 22857,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_get_many_api.py",
"chars": 82954,
"preview": "import json\nfrom collections import OrderedDict\nfrom urllib.parse import urlencode\n\nfrom starlette.testclient import Tes"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_get_one_api.py",
"chars": 50329,
"preview": "import json\n\nfrom starlette.testclient import TestClient\n\n\nfrom src.fastapi_quickcrud.crud_router import crud_router_bui"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_other_default_value.py",
"chars": 36424,
"preview": "import json\nimport os\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfrom http impor"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_other_set_description.py",
"chars": 37040,
"preview": "import json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfro"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_other_single_unique.py",
"chars": 37148,
"preview": "import json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfro"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_other_uuid_primary.py",
"chars": 37186,
"preview": "import json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfro"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_patch_many_api.py",
"chars": 19567,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_patch_one_api.py",
"chars": 20024,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_post_redirect_get_api.py",
"chars": 12312,
"preview": "import json\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\nfrom http import HTTPStatus\n\nfrom starl"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_put_many_api.py",
"chars": 25820,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test/test_put_one_api.py",
"chars": 15262,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/__init__.py",
"chars": 2988,
"preview": "import asyncio\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, D"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_create_many_api.py",
"chars": 15093,
"preview": "import json\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\n\nfrom starlette.testclient import TestC"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_create_one_api.py",
"chars": 17333,
"preview": "import json\nimport random\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\n\nfrom starlette.testclien"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_delete_many_api.py",
"chars": 15040,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_delete_one_api.py",
"chars": 20899,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_get_many_api.py",
"chars": 83065,
"preview": "import json\nfrom collections import OrderedDict\nfrom urllib.parse import urlencode\n\nfrom starlette.testclient import Tes"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_get_one_api.py",
"chars": 52955,
"preview": "import json\nimport os\n\nfrom sqlalchemy.ext.asyncio import create_async_engine, AsyncSession\nfrom sqlalchemy.orm import s"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_other_default_value.py",
"chars": 38723,
"preview": "import asyncio\nimport json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_other_single_unique.py",
"chars": 37945,
"preview": "import asyncio\nimport json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_other_uuid_primary.py",
"chars": 37763,
"preview": "import asyncio\nimport json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_patch_many_api.py",
"chars": 19890,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_patch_one_api.py",
"chars": 20144,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_post_redirect_get_api.py",
"chars": 9696,
"preview": "import json\nimport os\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\nfrom http import HTTPStatus\n\n"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_put_many_api.py",
"chars": 26177,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy/api_test_async/test_put_one_api.py",
"chars": 14237,
"preview": "import json\nimport os\nfrom collections import OrderedDict\n\nfrom sqlalchemy.ext.asyncio import create_async_engine, Async"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_create_null_type.py",
"chars": 2905,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, Numeric, Sm"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_create_specific_api_when_no_pk.py",
"chars": 4299,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_create_table_with_more_than_one_unique_but_no_use_composite.py",
"chars": 3061,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_use_blob_type_column.py",
"chars": 2870,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_use_composite_primary.py",
"chars": 2477,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_use_more_than_one_pk.py",
"chars": 2426,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_use_more_than_one_unique.py",
"chars": 2584,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_use_unique_and_composite_unique.py",
"chars": 2600,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_use_unsupported_type_pk.py",
"chars": 2409,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_use_unsupported_type_pk_2.py",
"chars": 2406,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_use_unsupported_type_pk_3.py",
"chars": 2402,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy/error_test/test_use_unsupported_type_pk_4.py",
"chars": 2403,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/__init__.py",
"chars": 2276,
"preview": "import os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import ARRAY, BigInteger, Boolean, CHAR,Table, Column, Date, Date"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_delete_many_api.py",
"chars": 13863,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_delete_one_api.py",
"chars": 10702,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_get_many_api.py",
"chars": 80335,
"preview": "import json\nfrom collections import OrderedDict\nfrom urllib.parse import urlencode\n\nfrom starlette.testclient import Tes"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_get_one_api.py",
"chars": 51967,
"preview": "import json\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud import sqlalchemy_to_pydantic\nfrom "
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_other_no_alias.py",
"chars": 36290,
"preview": "import json\nimport os\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfrom http impor"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_other_set_description.py",
"chars": 37798,
"preview": "import json\nimport os\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfrom http impor"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_other_single_unique.py",
"chars": 36608,
"preview": "import json\nimport os\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfrom http impor"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_other_user_default_value.py",
"chars": 37765,
"preview": "import json\nimport os\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfrom http impor"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_other_uuid_primary.py",
"chars": 36506,
"preview": "import json\nimport os\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date, timedelta\nfrom http impor"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_patch_many_api.py",
"chars": 9590,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_patch_one_api.py",
"chars": 10017,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_post_redirect_get_api.py",
"chars": 8499,
"preview": "import json\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\nfrom http import HTTPStatus\n\nfrom starl"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_put_many_api.py",
"chars": 15922,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_put_one_api.py",
"chars": 12546,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_upsert_many_api.py",
"chars": 15031,
"preview": "import json\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\n\nfrom starlette.testclient import TestC"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test/test_upsert_one_api.py",
"chars": 14911,
"preview": "import json\nimport random\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\n\nfrom starlette.testclien"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/__init__.py",
"chars": 2790,
"preview": "import asyncio\nimport os\n\nfrom fastapi import FastAPI\nfrom sqlalchemy import ARRAY, BigInteger, Boolean, CHAR,Table, Col"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_create_many_api.py",
"chars": 15091,
"preview": "import json\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\n\nfrom starlette.testclient import TestC"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_create_one_api.py",
"chars": 15155,
"preview": "import json\nimport random\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\n\nfrom starlette.testclien"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_delete_many_api.py",
"chars": 14307,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\nfrom src.fastapi_quickcrud "
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_delete_one_api.py",
"chars": 11000,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_get_many_api.py",
"chars": 80458,
"preview": "import json\nfrom collections import OrderedDict\nfrom urllib.parse import urlencode\n\nfrom starlette.testclient import Tes"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_get_one_api.py",
"chars": 50886,
"preview": "import json\nimport os\n\nfrom sqlalchemy.ext.asyncio import create_async_engine, AsyncSession\nfrom sqlalchemy.orm import s"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_other_default_value.py",
"chars": 38557,
"preview": "import asyncio\nimport json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_other_no_alias.py",
"chars": 37533,
"preview": "import asyncio\nimport json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_other_single_unique.py",
"chars": 37992,
"preview": "import asyncio\nimport json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_other_uuid_primary.py",
"chars": 37717,
"preview": "import asyncio\nimport json\nimport os\nimport uuid\nfrom copy import deepcopy\nfrom datetime import datetime, timezone, date"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_patch_many_api.py",
"chars": 17616,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_patch_one_api.py",
"chars": 17424,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_post_redirect_get_api.py",
"chars": 10104,
"preview": "import json\nimport uuid\nfrom datetime import date, timedelta, datetime, timezone\nfrom http import HTTPStatus\n\nfrom starl"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_put_many_api.py",
"chars": 20925,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/api_test_async/test_put_one_api.py",
"chars": 14204,
"preview": "import json\nfrom collections import OrderedDict\n\nfrom starlette.testclient import TestClient\n\nfrom src.fastapi_quickcrud"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_create_null_type.py",
"chars": 3028,
"preview": "import os\n\nfrom sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, "
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_pk_no_default_value.py",
"chars": 2373,
"preview": "from sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, LargeBinary"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_use_composite_primary.py",
"chars": 2583,
"preview": "from sqlalchemy import ARRAY, BigInteger, Table, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, Larg"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_use_more_than_one_pk.py",
"chars": 2567,
"preview": "from sqlalchemy import ARRAY, BigInteger, Table, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, Larg"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_use_more_than_one_unique.py",
"chars": 2642,
"preview": "from sqlalchemy import ARRAY, BigInteger,Table, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, Large"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_use_unique_and_composite_unique.py",
"chars": 2612,
"preview": "from sqlalchemy import ARRAY, BigInteger,Table, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, Large"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_use_unsupported_type.py",
"chars": 2486,
"preview": "from sqlalchemy import ARRAY, BigInteger, Table, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n JSON, Larg"
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_use_unsupported_type_2.py",
"chars": 3130,
"preview": "import os\n\nfrom sqlalchemy import ARRAY, BigInteger, Table, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n "
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_use_unsupported_type_3.py",
"chars": 3126,
"preview": "import os\n\nfrom sqlalchemy import ARRAY, BigInteger, Table, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n "
},
{
"path": "tests/test_implementations/test_sqlalchemy_table/error_test/test_use_unsupported_type_4.py",
"chars": 3127,
"preview": "import os\n\nfrom sqlalchemy import ARRAY, BigInteger, Table, Boolean, CHAR, Column, Date, DateTime, Float, Integer, \\\n "
},
{
"path": "tutorial/__init__.py",
"chars": 2538,
"preview": "from collections import defaultdict\n\na = [\n {\n \"id\": 1,\n \"id_foreign\": {\n \"id\": 1,\n "
},
{
"path": "tutorial/basic_usage/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tutorial/basic_usage/depencies_example_auth.py",
"chars": 7603,
"preview": "from typing import Optional\n\nimport uvicorn\nfrom fastapi import FastAPI, Depends, Security, Request\nfrom fastapi.securit"
},
{
"path": "tutorial/basic_usage/quick_usage_with_async_SQLALchemy_Base.py",
"chars": 6502,
"preview": "from datetime import datetime, timezone\n\nimport uvicorn\nfrom fastapi import FastAPI\nfrom sqlalchemy import *\nfrom sqlalc"
},
{
"path": "tutorial/basic_usage/quick_usage_with_async_SQLALchemy_table.py",
"chars": 6730,
"preview": "import uvicorn\nfrom fastapi import FastAPI\nfrom sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTi"
},
{
"path": "tutorial/basic_usage/quick_usage_with_async_SQLALchemy_table_with_out_primary_key.py",
"chars": 5060,
"preview": "import uvicorn\nfrom fastapi import FastAPI\nfrom sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTi"
},
{
"path": "tutorial/basic_usage/quick_usage_with_sync_SQLAlchemy_Base.py",
"chars": 6518,
"preview": "import uvicorn\nfrom fastapi import FastAPI\nfrom sqlalchemy import ARRAY, BigInteger, Boolean, CHAR, Column, Date, DateTi"
}
]
// ... and 12 more files (download for full content)
About this extraction
This page contains the full source code of the LuisLuii/FastAPIQuickCRUD GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 212 files (2.9 MB), approximately 779.2k tokens, and a symbol index with 1154 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.