Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastianmahecha/traffic_offences
This project is a practice API. I'm using Python + FastApi, PostgreSQL and machine learning tools
https://github.com/sebastianmahecha/traffic_offences
api fastapi python
Last synced: 27 days ago
JSON representation
This project is a practice API. I'm using Python + FastApi, PostgreSQL and machine learning tools
- Host: GitHub
- URL: https://github.com/sebastianmahecha/traffic_offences
- Owner: SebastianMahecha
- Created: 2024-10-25T18:46:13.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-08T11:33:13.000Z (2 months ago)
- Last Synced: 2024-11-08T12:29:48.384Z (2 months ago)
- Topics: api, fastapi, python
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# traffic_offences
RUN PROJECT
fastapi dev main.py
conda activate traffic_offences_env
create database traffic_offences_db;
CREATE ROLE traffic_offences_user WITH LOGIN PASSWORD '12345678';
grant all privileges on database traffic_offences_db to traffic_offences_user;
ALTER DATABASE traffic_offences_db OWNER TO traffic_offences_user;psql -U traffic_offences_user -d traffic_offences_db
pip install fastapi uvicorn sqlalchemy asyncpg
Config automigrate
pip install alembic
alembic init alembicModificar el archivo env.py,
agregar el target_metadatatarget_metadata = SQLModel.metadata
Reemplazar las urls de la DB en offline y online
DATABASE_URL = os.getenv("DATABASE_URL")reemplazar el connectable del online
connectable = create_engine(DATABASE_URL)
importar los modelos del proyecto
from models import *agregar la siguiente linea en el archivo script.py.mako
import sqlmodel # added
Crear migraciones
alembic revision --autogenerate -m "create user table"
correr migracion
alembic upgrade head