Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyPI PyPI - Python Version PyPI - Downloads

The Python SQL Toolkit and Object Relational Mapper

Introduction

SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL. SQLAlchemy provides a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a simple and Pythonic domain language.

Major SQLAlchemy features include:

  • An industrial strength ORM, built from the core on the identity map, unit of work, and data mapper patterns. These patterns allow transparent persistence of objects using a declarative configuration system. Domain models can be constructed and manipulated naturally, and changes are synchronized with the current transaction automatically.

  • A relationally-oriented query system, exposing the full range of SQL’s capabilities explicitly, including joins, subqueries, correlation, and most everything else, in terms of the object model. Writing queries with the ORM uses the same techniques of relational composition you use when writing SQL. While you can drop into literal SQL at any time, it’s virtually never needed.

  • A comprehensive and flexible system of eager loading for related collections and objects. Collections are cached within a session, and can be loaded on individual access, all at once using joins, or by query per collection across the full result set.

  • A Core SQL construction system and DBAPI interaction layer. The SQLAlchemy Core is separate from the ORM and is a full database abstraction layer in its own right, and includes an extensible Python-based SQL expression language, schema metadata, connection pooling, type coercion, and custom types.

  • All primary and foreign key constraints are assumed to be composite and natural. Surrogate integer primary keys are of course still the norm, but SQLAlchemy never assumes or hardcodes to this model.

  • Database introspection and generation. Database schemas can be “reflected” in one step into Python structures representing database metadata; those same structures can then generate CREATE statements right back out - all within the Core, independent of the ORM.

SQLAlchemy’s philosophy:

  • SQL databases behave less and less like object collections the more size and performance start to matter; object collections behave less and less like tables and rows the more abstraction starts to matter. SQLAlchemy aims to accommodate both of these principles.

  • An ORM doesn’t need to hide the “R”. A relational database provides rich, set-based functionality that should be fully exposed. SQLAlchemy’s ORM provides an open-ended set of patterns that allow a developer to construct a custom mediation layer between a domain model and a relational schema, turning the so-called “object relational impedance” issue into a distant memory.

  • The developer, in all cases, makes all decisions regarding the design, structure, and naming conventions of both the object model as well as the relational schema. SQLAlchemy only provides the means to automate the execution of these decisions.

  • With SQLAlchemy, there’s no such thing as “the ORM generated a bad query” - you retain full control over the structure of queries, including how joins are organized, how subqueries and correlation is used, what columns are requested. Everything SQLAlchemy does is ultimately the result of a developer-initiated decision.

  • Don’t use an ORM if the problem doesn’t need one. SQLAlchemy consists of a Core and separate ORM component. The Core offers a full SQL expression language that allows Pythonic construction of SQL constructs that render directly to SQL strings for a target database, returning result sets that are essentially enhanced DBAPI cursors.

  • Transactions should be the norm. With SQLAlchemy’s ORM, nothing goes to permanent storage until commit() is called. SQLAlchemy encourages applications to create a consistent means of delineating the start and end of a series of operations.

  • Never render a literal value in a SQL statement. Bound parameters are used to the greatest degree possible, allowing query optimizers to cache query plans effectively and making SQL injection attacks a non-issue.

Documentation

Latest documentation is at:

https://www.sqlalchemy.org/docs/

Installation / Requirements

Full documentation for installation is at Installation.

Getting Help / Development / Bug reporting

Please refer to the SQLAlchemy Community Guide.

Code of Conduct

Above all, SQLAlchemy places great emphasis on polite, thoughtful, and constructive communication between users and developers. Please see our current Code of Conduct at Code of Conduct.

License

SQLAlchemy is distributed under the MIT license.

Download files

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

Source Distribution

sqlalchemy-2.1.0rc1.tar.gz (10.4 MB view details)

Uploaded Source

Built Distributions

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

sqlalchemy-2.1.0rc1-cp314-cp314t-macosx_11_0_arm64.whl (2.5 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

sqlalchemy-2.1.0rc1-cp314-cp314-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

sqlalchemy-2.1.0rc1-cp313-cp313-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

sqlalchemy-2.1.0rc1-cp312-cp312-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

sqlalchemy-2.1.0rc1-cp311-cp311-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.11Windows x86-64

sqlalchemy-2.1.0rc1-cp311-cp311-win32.whl (2.4 MB view details)

Uploaded CPython 3.11Windows x86

sqlalchemy-2.1.0rc1-cp311-cp311-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file sqlalchemy-2.1.0rc1.tar.gz.

File metadata

  • Download URL: sqlalchemy-2.1.0rc1.tar.gz
  • Upload date:
  • Size: 10.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.0

File hashes

Hashes for sqlalchemy-2.1.0rc1.tar.gz
Algorithm Hash digest
SHA256 a5be28230a3f7e63a8954d71d4ff281ae174b593ff95cafb52ae6b3459b2607c
MD5 eefcd0716919b285ac92bae39d2514c4
BLAKE2b-256 53780fe66ff82002bb86b3dccbeffb40a6b41062fc93a9a79eb39d017c045e6f

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.1.0rc1-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.1.0rc1-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0022e41dacd2d06cacecc79a387066b436e18f3c6cc5a399e56717f46b003e7e
MD5 3d181dcad7c06ceffb2fcd95f3a97603
BLAKE2b-256 fc50b8ca1f79668c947df627337890e9b56f7ff7425ce0fe061de386b965720e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy-2.1.0rc1-cp314-cp314t-macosx_11_0_arm64.whl:

Publisher: create-wheels.yaml on sqlalchemy/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 sqlalchemy-2.1.0rc1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.1.0rc1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b36a3051fba1a1e78f675a1f201a5e1384e5ac475fe963cc0a191e925de08b5
MD5 01668726a5cd2328d8b275a5cbff7fe4
BLAKE2b-256 ff64d5587f00018a801a0720f121c1e82507bb130a170d46dd7b8ae4bb025e85

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy-2.1.0rc1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: create-wheels.yaml on sqlalchemy/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 sqlalchemy-2.1.0rc1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.1.0rc1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a589e423507b2bc69ddbd6ae3a3783a723b04cd47866a9112aff746a06973a8
MD5 c6ac6b6aee900bbfca50ba3379263538
BLAKE2b-256 2e016a9c79f6f6444a53e7d64ac956dc4de3fcd0d5aed66ff60bd24b3a691529

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy-2.1.0rc1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: create-wheels.yaml on sqlalchemy/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 sqlalchemy-2.1.0rc1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.1.0rc1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26ba8829966dd377ec5842720e7a37d597348441a0cdca87b962ad7c9d0a23db
MD5 ae173ee70af1d7b07670e96c5d6f82f3
BLAKE2b-256 b6636dd90baa4960ee6f04d8d1df452d477d240ea43fe5f591a4015c9fbf5e35

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy-2.1.0rc1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: create-wheels.yaml on sqlalchemy/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 sqlalchemy-2.1.0rc1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.1.0rc1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5184ee6e23d7d103da4a11787b6133bd6ad65def47f54c02818ff8b285064001
MD5 ad16eb98681464ed798bb90a334849b3
BLAKE2b-256 9056a5e16e0033365bc8ff8ad84b6ac97700a0b7daa653d9a3b52c66d53fb8f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy-2.1.0rc1-cp311-cp311-win_amd64.whl:

Publisher: create-wheels.yaml on sqlalchemy/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 sqlalchemy-2.1.0rc1-cp311-cp311-win32.whl.

File metadata

  • Download URL: sqlalchemy-2.1.0rc1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for sqlalchemy-2.1.0rc1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 5f303a4204651f91fa0c804d75546c415e357727987c91401736bd8d56c0e5dd
MD5 29a929fc226a5c2aec573dc28a7fe7c9
BLAKE2b-256 3ea5560e2f3b500a9ae4cbeded70e6084028108e7c76b36f4c9017aa1773a19b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy-2.1.0rc1-cp311-cp311-win32.whl:

Publisher: create-wheels.yaml on sqlalchemy/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 sqlalchemy-2.1.0rc1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.1.0rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc353b527499c11b7ae506a8dda762fdd3b981fb84a909e7e4688af23a63489d
MD5 10d5be6a51c2e345b391804204cf3702
BLAKE2b-256 002fff5f57ab9cbefa4486f62b62294cc2fcf76eae0041beb7ae4e80d733dd3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy-2.1.0rc1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: create-wheels.yaml on sqlalchemy/sqlalchemy

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

Release history Release notifications | RSS feed

This release

2.1.0rc1 This release

8 files

2.0.52

52 files

2.0.51

58 files

2.0.50

58 files

2.0.49

63 files

2.0.48

63 files

2.0.47

63 files

2.0.46

59 files

2.0.45

52 files

2.0.44

57 files

2.0.43

57 files

2.0.42

57 files

2.0.41

57 files

2.0.40

57 files

2.0.39

57 files

2.0.38

57 files

2.0.37

57 files

2.0.36

57 files

2.0.35

49 files

2.0.34

49 files

2.0.33

49 files

2.0.32

49 files

2.0.31

49 files

2.0.30

49 files

2.0.29

49 files

2.0.28

49 files

2.0.27

49 files

2.0.26

49 files

2.0.25

49 files

2.0.24

49 files

2.0.23

49 files

2.0.22

49 files

2.0.21

49 files

2.0.20

41 files

2.0.19

41 files

2.0.18

41 files

2.0.17

41 files

2.0.16

41 files

2.0.15

41 files

2.0.14

41 files

2.0.13

41 files

2.0.12

41 files

2.0.11

41 files

2.0.10

41 files

2.0.9

41 files

2.0.8

41 files

2.0.7

41 files

2.0.6

41 files

2.0.5.post1

41 files

2.0.5

2 files

2.0.4

41 files

2.0.3

41 files

2.0.2

41 files

2.0.1

41 files

2.0.0

41 files

1.4.54

44 files

1.4.53

44 files

1.4.52

46 files

1.4.51

46 files

1.4.50

46 files

1.4.49

48 files

1.4.48

41 files

1.4.47

41 files

1.4.46

41 files

1.4.45

41 files

1.4.44

41 files

1.4.43

41 files

1.4.42

41 files

1.4.41

41 files

1.4.40

36 files

1.4.39

36 files

1.4.38

35 files

1.4.37

36 files

1.4.36

36 files

1.4.35

36 files

1.4.34

36 files

1.4.33

36 files

1.4.32

35 files

1.4.31

36 files

1.4.30

36 files

1.4.29

36 files

1.4.28

35 files

1.4.27

36 files

1.4.26

36 files

1.4.25

30 files

1.4.24

30 files

1.4.23

30 files

1.4.22

30 files

1.4.21

30 files

1.4.20

30 files

1.4.19

30 files

1.4.18

30 files

1.4.17

30 files

1.4.16

30 files

1.4.15

30 files

1.4.14

30 files

1.4.13

34 files

1.4.12

34 files

1.4.11

34 files

1.4.10

34 files

1.4.9

34 files

1.4.8

34 files

1.4.7

34 files

1.4.6

34 files

1.4.5

34 files

1.4.4

34 files

1.4.3

34 files

1.4.2

34 files

1.4.1

34 files

1.4.0

34 files

1.3.24

34 files

1.3.23

38 files

1.3.22

38 files

1.3.21

38 files

1.3.20

38 files

1.3.19

32 files

1.3.18

28 files

1.3.17

28 files

1.3.16

19 files

1.3.15

1 file

1.3.14

1 file

1.3.13

1 file

1.3.12

1 file

1.3.11

1 file

1.3.10

1 file

1.3.9

1 file

1.3.8

1 file

1.3.7

1 file

1.3.6

1 file

1.3.5

1 file

1.3.4

1 file

1.3.3

1 file

1.3.2

1 file

1.3.1

1 file

1.3.0

1 file

1.2.19

1 file

1.2.18

1 file

1.2.17

1 file

1.2.16

1 file

1.2.15

1 file

1.2.14

1 file

1.2.13

1 file

1.2.12

1 file

1.2.11

1 file

1.2.10

1 file

1.2.9

1 file

1.2.8

1 file

1.2.7

1 file

1.2.6

1 file

1.2.5

1 file

1.2.4

1 file

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

1.1.18

1 file

1.1.17

1 file

1.1.16

1 file

1.1.15

1 file

1.1.14

1 file

1.1.13

1 file

1.1.12

1 file

1.1.11

1 file

1.1.10

1 file

1.1.9

1 file

1.1.8

1 file

1.1.7

1 file

1.1.6

1 file

1.1.5

1 file

1.1.4

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.19

1 file

1.0.18

1 file

1.0.17

1 file

1.0.16

1 file

1.0.15

1 file

1.0.14

1 file

1.0.13

1 file

1.0.12

1 file

1.0.11

1 file

1.0.10

1 file

1.0.9

1 file

1.0.8

1 file

1.0.7

1 file

1.0.6

1 file

1.0.5

1 file

1.0.4

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

0.9.10

1 file

0.9.9

1 file

0.9.8

1 file

0.9.7

1 file

0.9.6

1 file

0.9.5

1 file

0.9.4

1 file

0.9.3

1 file

0.9.2

1 file

0.9.1

1 file

0.9.0

1 file

0.8.7

1 file

0.8.6

1 file

0.8.5

1 file

0.8.4

1 file

0.8.3

1 file

0.8.2

1 file

0.8.1

1 file

0.8.0

1 file

0.7.10

1 file

0.7.9

1 file

0.7.8

1 file

0.7.7

1 file

0.7.6

1 file

0.7.5

1 file

0.7.4

1 file

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7.0

1 file

0.6.9

1 file

0.6.8

1 file

0.6.7

1 file

0.6.6

1 file

0.6.5

1 file

0.6.4

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

1 file

0.6.0

1 file

0.5.8

1 file

0.5.7

1 file

0.5.6

1 file

0.5.5

1 file

0.5.4

1 file

0.5.3

1 file

0.5.2

1 file

0.5.1

1 file

0.5.0

1 file

0.4.8

1 file

0.4.7

1 file

0.4.6

1 file

0.4.5

1 file

0.4.4

2 files

0.4.3

1 file

0.4.2

1 file

0.4.1

1 file

0.4.0

1 file

0.3.11

1 file

0.3.10

1 file

0.3.9

1 file

0.3.8

1 file

0.3.7

1 file

0.3.6

1 file

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.8

1 file

0.2.7

1 file

0.2.6

1 file

0.2.5

1 file

0.2.4

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page