The right way is this one (connect_timeout
instead of connection_timeout
):
create_engine(db_url, connect_args={'connect_timeout': 10})
…and it works with both Postgres and MySQL
ps: (the timeout is defined in seconds)
More Related Contents:
- sqlalchemy.exc.NoSuchModuleError: Can’t load plugin: sqlalchemy.dialects:postgres
- psycopg2: insert multiple rows with one query
- How to write DataFrame to postgres table
- Parameterized queries with psycopg2 / Python DB-API and PostgreSQL
- Passing table name as a parameter in psycopg2
- CS50: LIKE operator, variable substitution with % expansion
- DatabaseError: current transaction is aborted, commands ignored until end of transaction block?
- Executing multiple statements with Postgresql via SQLAlchemy does not persist changes
- error installing psycopg2, library not found for -lssl
- How to create an SQL View with SQLAlchemy?
- How to set up a PostgreSQL database in Django
- How can I use psycopg2.extras in sqlalchemy?
- Updates to JSON field don’t persist to DB
- psycopg2.OperationalError: FATAL: unsupported frontend protocol 1234.5679: server supports 2.0 to 3.0
- Psycopg2 image not found
- How to upsert pandas DataFrame to PostgreSQL table?
- SQLAlchemy multiple foreign keys in one mapped class to the same primary key
- Create a Postgres database using python
- SQLAlchemy – performing a bulk upsert (if exists, update, else insert) in postgresql
- Strange SQLAlchemy error message: TypeError: ‘dict’ object does not support indexing
- Creating partial unique index with sqlalchemy on Postgres
- SQLAlchemy func.count on boolean column
- Python/postgres/psycopg2: getting ID of row just inserted
- Escape SQL “LIKE” value for Postgres with psycopg2
- SQLAlchemy: filtering on values stored in nested list of the JSONB field
- How to prevent UUID primary key for new SQLAlchemy objects being created with the same value
- Mac + virtualenv + pip + postgresql = Error: pg_config executable not found
- “Failed building wheel for psycopg2” – MacOSX using virtualenv and pip
- Use binary COPY table FROM with psycopg2
- How Postgresql COPY TO STDIN With CSV do on conflic do update?