# Data flow — sqlalchemy/sqlalchemy

> Canonical page: https://codevetter.com/unpack/sqlalchemy/data-flow

# Data flow — sqlalchemy/sqlalchemy

Scanned commit 890d62f4337fe4af1afc36358fb536cf754fc231 (2026-10-02). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Inputs enter as database URLs, connection options, SQL expression objects, parameter collections, or mapped instances. Engine construction converts configuration into dialect, driver, and pool objects, and statement execution converts expressions into SQL plus driver parameters. Sessions retain object identity and pending changes, while databases retain durable data. Results travel back through execution contexts and, for ORM queries, row processors that reuse or instantiate mapped objects.
- create_engine converts its URL with make_url, instantiates URL-selected plugins, resolves the dialect entrypoint, imports the DBAPI, and merges dialect-generated connection parameters with connect_args. — [lib/sqlalchemy/engine/create.py#L548-L558](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/create.py#L548-L558) [lib/sqlalchemy/engine/create.py#L577-L604](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/create.py#L577-L604) [lib/sqlalchemy/engine/create.py#L617-L619](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/create.py#L617-L619)
- Connection acquisition moves through Engine.connect, Connection construction, Engine.raw_connection, and Pool.connect; pool connection records invoke the configured creator to obtain the actual driver connection. — [lib/sqlalchemy/engine/base.py#L143-L156](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/base.py#L143-L156) [lib/sqlalchemy/engine/base.py#L3237-L3260](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/base.py#L3237-L3260) [lib/sqlalchemy/pool/base.py#L437-L445](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/pool/base.py#L437-L445) [lib/sqlalchemy/pool/base.py#L894-L904](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/pool/base.py#L894-L904)
- Connection.execute distills parameters and delegates to the statement; _execute_clauseelement merges statement, connection, and call options before compiling and constructing an execution context. — [lib/sqlalchemy/engine/base.py#L1442-L1452](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/base.py#L1442-L1452) [lib/sqlalchemy/engine/base.py#L1626-L1639](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/base.py#L1626-L1639) [lib/sqlalchemy/engine/base.py#L1654-L1680](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/base.py#L1654-L1680)
- Compilation caching requires both an available cache and dialect support; cache keys include dialect, expression structure, column keys, schema-translation presence, and executemany mode. — [lib/sqlalchemy/sql/elements.py#L711-L746](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/sql/elements.py#L711-L746)
- The execution context autobegins when necessary, selects insertmanyvalues or ordinary execution, invokes dialect cursor operations, and constructs a result proxy after post_exec. — [lib/sqlalchemy/engine/base.py#L1814-L1824](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/base.py#L1814-L1824) [lib/sqlalchemy/engine/base.py#L1897-L1945](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/base.py#L1897-L1945) [lib/sqlalchemy/engine/base.py#L1957-L1964](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/engine/base.py#L1957-L1964)
- Session._flush gathers dirty, new, and deleted states into UOWTransaction; persistence splits states into inserts and updates and executes statements through Core Connection objects. — [lib/sqlalchemy/orm/session.py#L4563-L4580](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/orm/session.py#L4563-L4580) [lib/sqlalchemy/orm/session.py#L4618-L4640](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/orm/session.py#L4618-L4640) [lib/sqlalchemy/orm/persistence.py#L59-L98](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/orm/persistence.py#L59-L98) [lib/sqlalchemy/orm/persistence.py#L1049-L1079](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/orm/persistence.py#L1049-L1079)
- ORM SELECT execution calls conn.execute, builds QueryContext, and calls loading.instances; identity keys combine mapped identity class, primary-key values, and identity token before session lookup or attachment. — [lib/sqlalchemy/orm/context.py#L307-L326](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/orm/context.py#L307-L326) [lib/sqlalchemy/orm/context.py#L620-L630](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/orm/context.py#L620-L630) [lib/sqlalchemy/orm/loading.py#L1085-L1131](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/orm/loading.py#L1085-L1131)
- Async execution sends synchronous engine work into greenlet_spawn; await_ switches driver awaitables to the parent, which awaits them and returns results or throws exceptions back into the worker greenlet. — [lib/sqlalchemy/ext/asyncio/engine.py#L667-L674](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/ext/asyncio/engine.py#L667-L674) [lib/sqlalchemy/util/concurrency.py#L143-L167](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/util/concurrency.py#L143-L167) [lib/sqlalchemy/util/concurrency.py#L189-L220](https://github.com/sqlalchemy/sqlalchemy/blob/890d62f4337fe4af1afc36358fb536cf754fc231/lib/sqlalchemy/util/concurrency.py#L189-L220)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
