From 546bdd0623248f6b6908e61a1ed078e656d550ba Mon Sep 17 00:00:00 2001 From: Thibaud Malbert Date: Fri, 11 Sep 2026 15:37:37 +0200 Subject: [PATCH 1/4] feat: add a fixture example in documentation --- .../projects_and_apps/included_apps.rst | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/src/piccolo/projects_and_apps/included_apps.rst b/docs/src/piccolo/projects_and_apps/included_apps.rst index 5966c92af..1e5252d70 100644 --- a/docs/src/piccolo/projects_and_apps/included_apps.rst +++ b/docs/src/piccolo/projects_and_apps/included_apps.rst @@ -113,7 +113,7 @@ There are two options: And finally, if you're loading a really large fixture, you can specify the ``chunk_size``. By default, Piccolo inserts up to 1,000 rows at a time, as the database adapter will complain if a single insert query is too large. So -if your fixture containts 10,000 rows, this will mean 10 insert queries. +if your fixture contains 10,000 rows, this will mean 10 insert queries. You can tune this number higher or lower if you want (lower if the table has a lot of columns, or higher if the table has few columns). @@ -122,6 +122,27 @@ table has a lot of columns, or higher if the table has few columns). piccolo fixtures load fixtures.json --chunk_size=500 +You can have an example of the expected structure of the `fixtures.json` file by +dumping existing data to a fixture file. If you don't have any data, here is a +short example: + +.. code-block:: json + + { + "my_wonderfull_piccolo_app": { + "Manager": [ + { "id": 1, "name": "Dave" }, + { "id": 2, "name": "Pythonistas" }, + { "id": 2, "name": "Rustaceans" } + ], + "Band": [ + { "id": 1, "name": "Pythonistas" "manager": 2 }, + { "id": 2, "name": "Darts", "manager": 2 }, + { "id": 3, "name": "Gophers", "manager": 1 } + ] + } + } + ------------------------------------------------------------------------------- meta From a2f42e21eaedb760708ed714ff72d86f171a2a04 Mon Sep 17 00:00:00 2001 From: Thibaud Malbert Date: Fri, 11 Sep 2026 15:38:12 +0200 Subject: [PATCH 2/4] feat: update code style configuration in VSCode --- docs/src/piccolo/contributing/index.rst | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/docs/src/piccolo/contributing/index.rst b/docs/src/piccolo/contributing/index.rst index de947e5fd..f0cac4c4a 100644 --- a/docs/src/piccolo/contributing/index.rst +++ b/docs/src/piccolo/contributing/index.rst @@ -65,19 +65,22 @@ Piccolo uses `Black `_ for formatting, preferably with a max line length of 79, to keep it consistent with `PEP8 `_ . -You can configure `VSCode `_ by modifying -``settings.json`` as follows: +You can configure `VSCode `_ by installing +`MyPy `_ and +`Black `_ extensions +and modifying ``settings.json`` as follows: .. code-block:: json { - "python.linting.enabled": true, - "python.linting.mypyEnabled": true, - "python.formatting.provider": "black", - "python.formatting.blackArgs": [ - "--line-length", - "79" - ], + "mypy-type-checker.reportingScope": "workspace", + "mypy-type-checker.preferDaemon": true, + "mypy-type-checker.importStrategy": "fromEnvironment", + "black-formatter.importStrategy": "fromEnvironment", + "black-formatter.args": ["--line-length", "79"], + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter" + }, "editor.formatOnSave": true } From 15a4360c99d30915fa21d9a2da2cef3b584e86c2 Mon Sep 17 00:00:00 2001 From: Thibaud Malbert Date: Fri, 11 Sep 2026 15:44:22 +0200 Subject: [PATCH 3/4] feat: add a docker compose for easy test environment setup --- docs/src/piccolo/contributing/index.rst | 2 +- tests/docker-compose.yaml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/docker-compose.yaml diff --git a/docs/src/piccolo/contributing/index.rst b/docs/src/piccolo/contributing/index.rst index f0cac4c4a..1ca4ed7d4 100644 --- a/docs/src/piccolo/contributing/index.rst +++ b/docs/src/piccolo/contributing/index.rst @@ -37,7 +37,7 @@ Get the tests running * Install development dependencies: ``pip install -r requirements/dev-requirements.txt`` * Install test dependencies: ``pip install -r requirements/test-requirements.txt`` * Install database drivers: ``pip install -r requirements/extras/postgres.txt -r requirements/extras/sqlite.txt`` -* Setup Postgres, and make sure a database called ``piccolo`` exists (see ``tests/postgres_conf.py``). +* Setup database engines, and make sure a database called ``piccolo`` exists (see ``tests/postgres_conf.py``, ``tests/sqlite_conf.py``, ``tests/cockroach_conf.py``). For an easy test database setup, you can use the Docker composition in ``tests/docker-compose.yml``. * Run the automated code linting/formatting tools: ``./scripts/lint.sh`` * Run the test suite with Postgres: ``./scripts/test-postgres.sh`` * Run the test suite with Cockroach: ``./scripts/test-cockroach.sh`` diff --git a/tests/docker-compose.yaml b/tests/docker-compose.yaml new file mode 100644 index 000000000..ee2a07181 --- /dev/null +++ b/tests/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + postgres: + image: docker.io/postgres:18-alpine + ports: + - '${PG_PORT:-5432}:5432' + environment: + POSTGRES_HOST: ${PG_HOST:-localhost} + POSTGRES_USER: ${PG_USER:-postgres} + POSTGRES_PASSWORD: ${PG_PASSWORD} + POSTGRES_DB: ${PG_DATABASE:-piccolo} + POSTGRES_HOST_AUTH_METHOD: trust + + cockroach: + image: cockroachdb/cockroach:latest-v25.4 + ports: + - '${PG_PORT:-26257}:26257' + environment: + COCKROACH_USER: ${PG_USER:-postgres} + COCKROACH_PASSWORD: ${PG_PASSWORD} + COCKROACH_DATABASE: ${PG_DATABASE:-piccolo} + command: start-single-node --insecure From bf1112af971ed6a0f242845156891ced941261e6 Mon Sep 17 00:00:00 2001 From: Thibaud Malbert Date: Mon, 14 Sep 2026 10:01:34 +0200 Subject: [PATCH 4/4] fix: typo --- docs/src/piccolo/projects_and_apps/included_apps.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/piccolo/projects_and_apps/included_apps.rst b/docs/src/piccolo/projects_and_apps/included_apps.rst index 1e5252d70..37b5fbc17 100644 --- a/docs/src/piccolo/projects_and_apps/included_apps.rst +++ b/docs/src/piccolo/projects_and_apps/included_apps.rst @@ -129,7 +129,7 @@ short example: .. code-block:: json { - "my_wonderfull_piccolo_app": { + "my_wonderful_piccolo_app": { "Manager": [ { "id": 1, "name": "Dave" }, { "id": 2, "name": "Pythonistas" },