Understanding Relational Databases and SQLAlchemy

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/27

flashcard set

Earn XP

Description and Tags

Quiz 2: part 1

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

28 Terms

1
New cards

Relational Database

Organizes data into structured tables (relations) that connect through shared data fields.

2
New cards

Tables

Collections of rows (records) and columns (attributes) representing entities (e.g., users, products).

3
New cards

Primary Key

Unique identifier for each record in a table, ensuring that no two rows share the same primary key value.

4
New cards

Foreign Key

Column in one table that references the primary key in another table, establishing relationships between tables.

5
New cards

SQL

The primary language used to query, update, and manage relational databases.

6
New cards

CRUD Operations

Create: Inserting new records into a table; Read: Selecting and retrieving data from tables; Update: Modifying existing records; Delete: Removing records from tables.

7
New cards

Atomicity

Ensures that all parts of a transaction are completed; if one part fails, the entire transaction is rolled back.

8
New cards

Consistency

Ensures that a transaction only brings the database from one valid state to another, adhering to all predefined rules and constraints.

9
New cards

Isolation

Ensures that transactions are executed in isolation, meaning one transaction's changes are invisible to others until completed.

10
New cards

Durability

Ensures that once a transaction is committed, it remains saved, even if there is a power loss or crash.

11
New cards

Transaction

A sequence of operations treated as a single logical unit of work, which must either fully complete or not occur at all.

12
New cards

SQLAlchemy Engine

Maintains a stable connection to the database and enables running SQL queries.

13
New cards

SQLAlchemy Core

Enables stable database connections and includes abstractions to run SQL queries.

14
New cards

SQLAlchemy Entities

Represent tables in our SQL database.

15
New cards

DeclarativeBase

Class from which all entities in the CSXL repository inherit.

16
New cards

UNCBasketballTicketEntity

Entity used to represent basketball tickets in SQLAlchemy.

17
New cards

Pydantic Models

Define data structure for API validation, while SQLAlchemy entities define database structure.

18
New cards

OrganizationEntity

Entity that represents the organization table in SQL.

19
New cards

SQL Table Name

Defined by OrganizationEntity as organization.

20
New cards

Primary Key in Organization Table

Field that uniquely identifies each row in the organization table.

21
New cards

CRUD Operations List

Create: Add new rows to the table; Read: Read existing rows from the table; Update: Modify existing rows on the table; Delete: Remove rows from the table.

22
New cards

All-or-Nothing Principle

Ensures that all requested changes occur or none do if an error occurs, maintaining data consistency.

23
New cards

SQLAlchemy Query

A request for data that can be built with more method calls.

24
New cards

GET /api/courses

API endpoint associated with the SQLAlchemy query select(CourseEntity).

25
New cards

List of Scalars

Data type of data in data = self._session.scalars(query).all().

26
New cards

SQLAlchemy Session

Object that represents SQLAlchemy's active connection to our database.

27
New cards

Many-to-Many Relationship

Models users having many reservations, and reservations for groups of users.

28
New cards

Association Table

Needed in a Many-to-Many relationship to track individual relationships between two entities.