SQLAlchemy 1.4 Documentation
- Previous: Working with Database Metadata
- Next: Inserting Rows with Core
- Up: Home
- On this page:
Working with Data¶
In Working with Transactions and the DBAPI, we learned the basics of how to
interact with the Python DBAPI and its transactional state. Then, in
Working with Database Metadata, we learned how to represent database
tables, columns, and constraints within SQLAlchemy using the
MetaData
and related objects. In this section we will combine
both concepts above to create, select and manipulate data within a relational
database. Our interaction with the database is always in terms
of a transaction, even if we’ve set our database driver to use autocommit behind the scenes.
The components of this section are as follows:
Inserting Rows with Core - to get some data into the database, we introduce and demonstrate the Core
Insert
construct. INSERTs from an ORM perspective are described in the next section Data Manipulation with the ORM.Selecting Rows with Core or ORM - this section will describe in detail the
Select
construct, which is the most commonly used object in SQLAlchemy. TheSelect
construct emits SELECT statements for both Core and ORM centric applications and both use cases will be described here. Additional ORM use cases are also noted in the later section Using Relationships in Queries as well as the ORM Querying Guide.Updating and Deleting Rows with Core - Rounding out the INSERT and SELECTion of data, this section will describe from a Core perspective the use of the
Update
andDelete
constructs. ORM-specific UPDATE and DELETE is similarly described in the Data Manipulation with the ORM section.
flambé! the dragon and The Alchemist image designs created and generously donated by Rotem Yaari.
Created using Sphinx 7.2.6. Documentation last generated: Wed 30 Oct 2024 02:18:58 PM EDT