Metadata-Version: 2.4
Name: scim2-sqlalchemy
Version: 0.3.0
Summary: Painless SCIM integration for SQLAlchemy
Keywords: scim,scim2,provisioning,sqlalchemy,rfc7643,rfc7644
Author: Éloi Rivard
Author-email: Éloi Rivard <eloi@yaal.coop>
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Environment :: Web Environment
Classifier: Programming Language :: Python
Classifier: Operating System :: OS Independent
Requires-Dist: scim2-models>=0.12.7
Requires-Dist: scim2-server>=0.8.9
Requires-Dist: sqlalchemy>=2.0.41
Requires-Dist: sqlalchemy[asyncio]>=2.0.41 ; extra == 'asyncio'
Requires-Python: >=3.11
Project-URL: documentation, https://scim2-sqlalchemy.readthedocs.io
Project-URL: repository, https://github.com/python-scim/scim2-sqlalchemy
Project-URL: funding, https://github.com/sponsors/python-scim
Provides-Extra: asyncio
Description-Content-Type: text/markdown

<img alt="python-scim logo" src="https://raw.githubusercontent.com/python-scim/.github/refs/heads/main/python-scim.svg" height="72" align="right">

# scim2-sqlalchemy

Store [SCIM](https://scim.cloud) resources in the tables of an application, with the [SQLAlchemy](https://www.sqlalchemy.org) ORM.

A mapping declares which column holds each SCIM attribute.
A storage then reads, writes, filters, sorts and pages the resources for [scim2-server](https://scim2-server.readthedocs.io), which serves the SCIM protocol of [RFC 7643](https://www.rfc-editor.org/rfc/rfc7643) and [RFC 7644](https://www.rfc-editor.org/rfc/rfc7644).

```python
from scim2_models import User
from scim2_sqlalchemy import Many, ResourceMapping, SqlAlchemyStorage

users = ResourceMapping(
    User,
    Account,
    {
        "id": Account.id,
        "userName": Account.login,
        "name.givenName": Account.first_name,
        "emails": Many(Account.emails, {"value": EmailAddress.address}),
        "meta.created": Account.created_at,
        "meta.lastModified": Account.updated_at,
    },
    version=Account.revision,
)
storage = SqlAlchemyStorage({"User": users}, lambda: session)
```

## Installation

```console
$ pip install scim2-sqlalchemy
```

The asynchronous storage needs the `asyncio` extra:

```console
$ pip install "scim2-sqlalchemy[asyncio]"
```

## Documentation

The [documentation](https://scim2-sqlalchemy.readthedocs.io) builds a SCIM server over existing tables, and describes the mappings, the transactions and the public API.

- Source code: [github.com/python-scim/scim2-sqlalchemy](https://github.com/python-scim/scim2-sqlalchemy)
- Bugtracker: [github.com/python-scim/scim2-sqlalchemy/issues](https://github.com/python-scim/scim2-sqlalchemy/issues)

## Contributing

Read the [contributing guide](https://scim2-sqlalchemy.readthedocs.io/en/latest/contributing.html).

## License

scim2-sqlalchemy is published under the terms of the [Apache 2.0 license](LICENSE).
