Skip to main content

xladmin-import-export backend

Optional backend extension for xladmin that adds import/export endpoints.

Features

  • export json, csv, xlsx
  • import json, csv, xlsx
  • export custom readable fields, including custom list_display fields
  • import validation before commit
  • PK conflict modes: auto_generate_pk, update_existing, skip_existing
  • UUID primary key auto-generation on import

Install

Import validation and commit use the current user's model scope for existing targets and assigned foreign keys. Hidden targets cannot be updated or treated as an existing row to skip; any invalid row makes commit roll back the batch. auto_generate_pk ignores the input primary key and does not resolve it as an existing target, but still validates assigned relations. Internal service calls require keyword registry and user; update the core and extension together.

pip install xladmin xladmin-import-export

Minimal Example

from fastapi import APIRouter
from xladmin import HttpConfig, create_router
from xladmin_import_export import ImportExportConfig, create_import_export_router

router = APIRouter()
router.include_router(create_router(http_config))
router.include_router(create_import_export_router(http_config))

user_model = ModelConfig(
    model=UserORM,
    slug="users",
    import_export=ImportExportConfig(),
)

# OR

user_model = ModelConfig(
    model=UserORM,
    slug="users",
    import_export=ImportExportConfig(
        export_fields=("id", "email", "roles"),
        import_fields=("id", "email", "roles"),
    ),
)

Endpoints

  • GET /xladmin/models/{slug}/import-export/meta/
  • POST /xladmin/models/{slug}/export/
  • POST /xladmin/models/{slug}/import/validate/
  • POST /xladmin/models/{slug}/import/commit/

Development

cd xladmin-backend/xladmin-import-export
uv sync --extra dev
uv run pytest -q
uv run ruff check .
uv run mypy
uv run python -m build

Docs

Release files for xladmin-import-export 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xladmin-import-export 0.2.0
File Size Uploaded
xladmin_import_export-0.2.0.tar.gz 15.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xladmin-import-export 0.2.0
File Interpreter ABI Platform
xladmin_import_export-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.7 kB

Release files / xladmin_import_export-0.2.0.tar.gz

Download URL xladmin_import_export-0.2.0.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
796a2aaede33be355ea22bcdf14597d7a07f33ddfdbce9b614cc079bef1fe8e7
BLAKE2b-256 checksum
How to use checksums
6685e3caea854c6d45702e790185e401f59b5b3a2bf0ec84d99799384d73bdf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / xladmin_import_export-0.2.0-py3-none-any.whl

Download URL xladmin_import_export-0.2.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7da0bb5c8e4d8287dbeb34f6e0571aa30d4f569715723e4316b8e8e4e3e4da29
BLAKE2b-256 checksum
How to use checksums
d0cff025f137b496fe52c4cd078ae3b0f920cd5ddf2cd3b6fb4f4ea54d77dfa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page