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.0.tar.gz (5.8 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.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: muscles_data_sqlalchemy-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 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.0.tar.gz
Algorithm Hash digest
SHA256 3c42b834a0aa7be3a1eded2b36c527bc18c797869778247785538f016b40eda3
MD5 8a7035b3a3dbf5a6b0a61476dfd678ca
BLAKE2b-256 8756db58b086bffe2829e027fc2f13bd43d2576803e3df20e3074c11ff1acb02

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_sqlalchemy-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for muscles_data_sqlalchemy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 091d0f0c93329a6bb81118d40c606f29b7e7e3a2dd8e878445d59bf9995790ac
MD5 83be98f571fea5bec19ba2106759d0a8
BLAKE2b-256 20935251809f4c074a14d20aefbfed0ea65d45f100a10fae7c754de31e484b3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_sqlalchemy-0.1.0-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