https://github.com/legendarym4x/sqlalchemy_with_alembic
SQLalchemy learn
https://github.com/legendarym4x/sqlalchemy_with_alembic
alembic postgresql python sql sqlalchemy
Last synced: about 1 month ago
JSON representation
SQLalchemy learn
- Host: GitHub
- URL: https://github.com/legendarym4x/sqlalchemy_with_alembic
- Owner: legendarym4x
- Created: 2023-12-17T15:27:29.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-12T13:10:07.000Z (over 2 years ago)
- Last Synced: 2025-01-01T14:29:16.798Z (over 1 year ago)
- Topics: alembic, postgresql, python, sql, sqlalchemy
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## SQLAlchemy with Alembic
We implemented our SQLAlchemy models for tables:
Table of students;
Table of groups;
Table of teachers;
Table of subjects with the indication of the teacher who reads the subject;
A table where each student has grades in subjects with an indication of when the grade was received.
We then used `alembic` to create migrations in the database.
We wrote the `seed.py` script and filled the resulting database with random data (~30-50 students, 3 groups,
5-8 subjects, 3-5 teachers, up to 20 grades for each student from all subjects). We used the `Faker` package
for filling. SQLAlchemy `session` mechanism was used when filling.
We also made the necessary selections from the obtained database.
For requests, a separate file `my_select.py` was created, where there are 10 functions from `select_1` to `select_10`.
Execution of the functions returns a result similar to the previous homework. For requests, we use the SQLAlchemy
`session` mechanism.