Skip to main content

SQLAlchemy

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.0.53.tar.gz (10.0 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.0.53-py3-none-any.whl (2.0 MB view details)

Uploaded Python 3

sqlalchemy-2.0.53-cp314-cp314t-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

sqlalchemy-2.0.53-cp311-cp311-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

sqlalchemy-2.0.53-cp310-cp310-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

sqlalchemy-2.0.53-cp39-cp39-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.9Windows x86-64

sqlalchemy-2.0.53-cp39-cp39-win32.whl (2.1 MB view details)

Uploaded CPython 3.9Windows x86

sqlalchemy-2.0.53-cp39-cp39-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

sqlalchemy-2.0.53-cp38-cp38-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.8Windows x86-64

sqlalchemy-2.0.53-cp38-cp38-win32.whl (2.1 MB view details)

Uploaded CPython 3.8Windows x86

sqlalchemy-2.0.53-cp38-cp38-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file sqlalchemy-2.0.53.tar.gz.

File metadata

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

File hashes

Hashes for sqlalchemy-2.0.53.tar.gz
Algorithm Hash digest
SHA256 b568a8ac0778988c2710476017ff74fb5dcb9b9322d757189c3d7fc4cc8026fa
MD5 56776ca4f763f8a087dc28116ad7fd0b
BLAKE2b-256 4cde59fc3d2e63dfd367e803417c40e70e35b6c0a0997420cb082d351cdd052b

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-py3-none-any.whl.

File metadata

  • Download URL: sqlalchemy-2.0.53-py3-none-any.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for sqlalchemy-2.0.53-py3-none-any.whl
Algorithm Hash digest
SHA256 87eb05fc61a0835dfe1cbf135d0f99cb2764ad09350d92fdd3fe1b827a557d65
MD5 cc2547761279aedcce2c8ae2497ac7ae
BLAKE2b-256 fc3c6ee5fe746b0820335d30c5172527e9a2c7409ac632376d15fded38ff715c

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.0.53-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41548248e8a5897d3a5f67ad8c1edb78efe72ec00dcc985b5c19b7850949d039
MD5 ace3e9dacae398b5b730ced3b23b2535
BLAKE2b-256 eb2706028ccab7e03887c68c5031a8e4e7bfc85f30c87449c79dcba49e7ccd55

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.0.53-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0a3481fdea08ce9f93c318e40c446c91bc63260a5eae1cf06d85b4d4d5651d4
MD5 099942c22322ba014ffd2f500f26fef3
BLAKE2b-256 e75868f32c4428e01aa784d045d74fdd9ceacca1f27b7030d468a7c90dcb0839

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.0.53-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cfd51b94590814cfa5020534225f61dda1af485299cd2dbb1ee8112d0e92b52f
MD5 f25617cebb8f5a0a9f32774f17e68af8
BLAKE2b-256 6d4b303c139417e53e7827e4f46a44a5bcc3f50ce713029abf26d79d93f2f314

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: sqlalchemy-2.0.53-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for sqlalchemy-2.0.53-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a02ff597675e80a7b312683ed88957120bd5b32ce69d92a8c696ebdd9c5a25dc
MD5 4121c942fc1aed0c72c1ed3883d32e5c
BLAKE2b-256 c873b6a303ec8d10bd446e5ba77a69cb3531c6a735062886eb012e6e4319f953

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-cp39-cp39-win32.whl.

File metadata

  • Download URL: sqlalchemy-2.0.53-cp39-cp39-win32.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for sqlalchemy-2.0.53-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 ea10e7eb83193dccbaaba8c370870c87f1a9b08b232df823e3e63905ec896e06
MD5 695f80ba4d2921e9490f940ec431ddbf
BLAKE2b-256 eeee602948750c2a7dd495e08341c70037c3bab8067202f55e0866d177c6b2bf

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.0.53-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae1a152a25bf194dbcda7d8ada169963ae7ed212951edc30fe72f1d4fcb96704
MD5 4773aa556a6b743918f175977d491ff8
BLAKE2b-256 44d6e4cdc9a982ff6a42f645910cd5057f6e60ea60689ea7fbaf43b578b708b0

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: sqlalchemy-2.0.53-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for sqlalchemy-2.0.53-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 dddaeea9fe9e3b7488c9acf1fdf77c0aa0e26e1d6f83a875b5cddf2e01948c7b
MD5 64ae35642318159431320cf93494e291
BLAKE2b-256 0a331154b7cf27e5abb00595ab0454d55d67430bde51c6d7f5cb5acdd6ba9a19

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-cp38-cp38-win32.whl.

File metadata

  • Download URL: sqlalchemy-2.0.53-cp38-cp38-win32.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for sqlalchemy-2.0.53-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 ceb32cdde9bdc93c004008fa3d6e4481b0978e46c6478ce8e6fffe0fcc1c9a0e
MD5 4ae6b9aca959f94391ea7a69eb1cc043
BLAKE2b-256 1aad5423475bd6fddb376ccb3cd09dc0c021384ba47aea5fc78022e0c3e426b1

See more details on using hashes here.

File details

Details for the file sqlalchemy-2.0.53-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sqlalchemy-2.0.53-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13f8f63343a7c34eef67bc8cf8b99d4a875d9f3431075ded7ffeabe22a49ff34
MD5 ab2f9d2be469922bc5046837aa8d842c
BLAKE2b-256 f668d4fad0787a413729f691ff15ff5a4157a5b543c7b06e1b8a64bf67b6a4ed

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.53 This release

11 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