Category : sqlalchemy

I am creating a FastAPI server with simple CRUD functionalities with Postgresql as database. Everything works well in my local environment. However, when I tried to make it run in containers using docker-compose up, it failed. I was getting this error: rest_api_1 | File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect rest_api_1 | conn = _connect(dsn, connection_factory=connection_factory, ..

Read more

Some background: I have a relatively simple docker-compose setup with a backend python-based service that has FastAPI and SQLAlchemy running, which connects to a postgres container that houses a decent (but not crazy) amount of data. All of the queries I run from psql directly inside the postgres container are as fast as expected (<1s ..

Read more

The following code is running into a Docker container. I have a connection specified as follow which is working as I could make a simple query based on it. from sqlalchemy import create_engine engine = create_engine("mssql+pyodbc://username:[email protected]?driver_name") con_xpf = engine.connect() con_xpf.execute("use db_name;") After that I create a sqlite3 DB and connect to it: DBNAME = "data/NEWDB.db" ..

Read more

I am trying to create_engine() with a schema that I know for sure works with SQLite and MySQL. I have created a docker image of PostgreSQL with the following docker-compose.yml services: db: image: postgres restart: always environment: POSTGRES_USER: test POSTGRES_PASSWORD: test POSTGRES_DB: test ports: – "5325:5432" expose: – 5325 And I am trying to connect ..

Read more

I am trying to dockersize powerdns-admin and it needs to connect to my mariadb via sqlalchemy. The docker-compose: docker-compose.yml version: "3" services: app: image: ngoduykhanh/powerdns-admin:latest container_name: powerdns_admin ports: – "9191:80" logging: driver: json-file options: max-size: 50m environment: – SQLALCHEMY_DATABASE_URI=mysql://root:[email protected]/powerdns – GUNICORN_TIMEOUT=60 – GUNICORN_WORKERS=2 – GUNICORN_LOGLEVEL=DEBUG – OFFLINE_MODE=False # True for offline, False for external resources ..

Read more

I find the workflow for working with database migrations in a containerized environment confusing. I have a web API with an attached database. The API runs in one container and the database in another. The project file structure is as follows . ├── docker-compose.yml ├── Dockerfile └── app | ├── __init__.py | ├── database | ..

Read more