Skip to main content

Optional import/export extension for xladmin backend.

Project description

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 your 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

pip install xladmin xladmin-import-export

Minimal Example

from fastapi import APIRouter
from xladmin import AdminHTTPConfig, create_admin_router
from xladmin_import_export import ImportExportConfig, create_import_export_router

router = APIRouter()
router.include_router(create_admin_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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xladmin_import_export-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xladmin_import_export-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file xladmin_import_export-0.1.0.tar.gz.

File metadata

  • Download URL: xladmin_import_export-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for xladmin_import_export-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c1bc2e5675e661597948e1a9cb0b229d96a0609dd28d198326495c1c26491b79
MD5 f4a0f1eac59eeb2ba5ab462c6f15ee7a
BLAKE2b-256 4c08daa0e542ce740133140067905a185ac9a998d36b76744f92bca4a2eac39f

See more details on using hashes here.

File details

Details for the file xladmin_import_export-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for xladmin_import_export-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51e17e5b47204cf01afdb50da5f6325f91c444e912ee84e1e1cc3478ef205aec
MD5 e9d018218d582487fa4cc089061d501e
BLAKE2b-256 2a45318db5f649a7335152bc5d2e513b55b01831bbd75c043b2f172914ff0c52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page