https://github.com/billwallis/database-crud-example
A simple example of a CRUD implementation for a database layer.
https://github.com/billwallis/database-crud-example
crud python sql
Last synced: 2 months ago
JSON representation
A simple example of a CRUD implementation for a database layer.
- Host: GitHub
- URL: https://github.com/billwallis/database-crud-example
- Owner: billwallis
- Created: 2025-01-19T11:40:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-10-08T05:55:13.000Z (9 months ago)
- Last Synced: 2025-12-28T04:25:47.347Z (6 months ago)
- Topics: crud, python, sql
- Language: Python
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://www.python.org/downloads/)
[](https://github.com/billwallis/database-crud-example/actions/workflows/tests.yaml)
[](https://github.com/dbrgn/coverage-badge)
[](https://shields.io/badges/git-hub-last-commit)
[](https://github.com/prettier/prettier)
[](https://github.com/astral-sh/ruff)
[](https://results.pre-commit.ci/latest/github/billwallis/database-crud-example/main)
[](https://www.postgresql.org/download/)
---
# Database CRUD Example
A simple example of a CRUD implementation for a database layer.
## Model
The model is loan system with accounts, customers, loans, and links between the accounts and customers ("account-customer bridges") since accounts can have multiple customers and customers can have multiple accounts.
```mermaid
---
title: Loan System
---
erDiagram
accounts {
int account_id
timestamp created_ts
timestamp updated_ts
bool deleted
}
customers {
int customer_id
varchar forename
varchar surname
date date_of_birth
varchar postcode
timestamp created_ts
timestamp updated_ts
bool deleted
}
account_customer_bridge {
int account_id
int customer_id
timestamp created_ts
timestamp updated_ts
bool deleted
}
loans {
int loan_id
int account_id
decimal amount
decimal interest_rate
date start_date
date end_date
decimal current_balance
timestamp created_ts
timestamp updated_ts
bool deleted
}
customers ||--|{ account_customer_bridge : ""
accounts ||--|{ account_customer_bridge : ""
accounts ||--o{ loans : "opens"
```