Skip to main content

SQLAlchemy SqlResourcePort adapter for muscles-data

Project description

muscles-data-sqlalchemy

SQLAlchemy adapter package for muscles-data.

This package is intentionally separate from muscles-data: the core package owns typed ports, resource runtime and diagnostics, while this package owns the SQLAlchemy-backed SqlResourcePort adapter.

Use this package when a project wants direct SQLAlchemy sessions through the same data resource runtime without wiring muscles-sql first.

Related packages

Usage

Register the factory in the project composition root:

from muscles_data.catalog import DataAdapterCatalog
from muscles_data.ports import SqlResourcePort
from muscles_data.runtime import DataRuntime
from muscles_data_sqlalchemy import SqlAlchemySqlResourceFactory

catalog = DataAdapterCatalog.with_defaults()
catalog.register(SqlAlchemySqlResourceFactory())

runtime = DataRuntime(config=config, catalog=catalog)
sql = runtime.require_port("sql.local", SqlResourcePort)

Resource config stays in the project:

data:
  resources:
    sql.local:
      type: sqlalchemy
      url: sqlite:///:memory:
      name: local_sqlite
      pool_pre_ping: true
      native_client: false

data.resources.list does not create the engine. The engine/session factory is created lazily by session(), session_factory(), explicit native access or data.doctor.

Application code should use SqlResourcePort; direct engine/session-factory access is only an advanced escape hatch with native_client: true.

See muscular-example/example_data_sqlalchemy_1 for an executable example.

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

muscles_data_sqlalchemy-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

muscles_data_sqlalchemy-0.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file muscles_data_sqlalchemy-0.1.1.tar.gz.

File metadata

  • Download URL: muscles_data_sqlalchemy-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for muscles_data_sqlalchemy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4929509974c078df35ce04f3d3fd9dc5d236fcfeaffccdfb49f67333f5749e6e
MD5 8227789bec9c743e70ed866dd95f6f92
BLAKE2b-256 a4bf70bf64ba3e4c2720da88babc3ac0f5a429f67e6cbe2d3d912aae0c5d88aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_sqlalchemy-0.1.1.tar.gz:

Publisher: release.yml on butkoden/muscles-data-sqlalchemy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file muscles_data_sqlalchemy-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for muscles_data_sqlalchemy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa30931d44c2a0fc3150faa819e114af4dfa682496e41970439a24e2a99b5fe6
MD5 f516c2ce3fab1b89c87b16cb65e7b152
BLAKE2b-256 6c9a6d74cbef363418a3f2a811faf702fe5c40a269995725ff33c74653097309

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_sqlalchemy-0.1.1-py3-none-any.whl:

Publisher: release.yml on butkoden/muscles-data-sqlalchemy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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