Skip to main content

All Questions

0 votes
1 answer
50 views

SQLAlchemy always fails with `invalid connection option` error

I am trying to connect with CockroachDB from Python using SQLAlchemy with SSL. In the below code I have shown various combinations I tried. I am getting error for all the combinations. Program import ...
Dinesh's user avatar
  • 1,880
1 vote
0 answers
28 views

When running multiprocessing with sqlalchemy I'm getting this error in Pycharm:

I'm having this error. The rows are inserted in database, but getting this error in pycharm, and it wont finish the loading on browser. def _insert_objects(temp_car_list): sess = Session(engine) ...
Terfy's user avatar
  • 11
0 votes
0 answers
51 views

Insert values from a list of dictionaries using SQLAlchemy Postgres in python

I have a table in RDS (aurora postgres) that looks like this: students: student_id (pk) student_name number_of_classes_taken one_violation multiple_violation 1234 joe_smith 1 False False 5678 ...
unlocknew's user avatar
0 votes
0 answers
51 views

Postgresql connection number increases and keeps high

I noticed the number of connections to my database can grow dramatically fast, and then drop. The problem is sometimes it doesn't drop itself, and I don't understand the overall behaviour. Trying to ...
mimic's user avatar
  • 5,254
1 vote
2 answers
634 views

Upsert on Conflict with sqlalchemy 2.x and Postgresql

I am using python to query an external api, transform the data and write it to a postgresql database internally. In that process, I am comparing the result from the api with existing data in the ...
chibisuketyan's user avatar
0 votes
1 answer
238 views

How can I batch create a SQL Alchemy model using factory boy?

Here is my database model (User): from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column class SqlAlchemyBase(DeclarativeBase): """Base SQL alchemy model.""&...
theQuestionMan's user avatar
0 votes
2 answers
188 views

"No function matches the given name and argument types." when trying to insert a `DateTimeTzRange` with Sqlalchemy ORM

I've got a database table in a Postgres 15 database, it's got two columns (amongst others), one is of type daterange, the other is tstzrange. We've got some code that inserts to this table with raw ...
Greg B's user avatar
  • 14.9k
0 votes
0 answers
28 views

sqlalchemy raw query timestamp

I'm trying to execute a raw SQL query in SQLAlchemy, but I'm encountering syntax errors. Here's the SQL query I'm trying to run: WITH RECURSIVE dates AS ( SELECT TIMESTAMP '2024-04-01 00:00:00' AS ...
Adam Smith's user avatar
1 vote
1 answer
460 views

How to change the execution options of a session and use the fetchmany option

I'm trying to adapt the following code (from this answer: from sqlalchemy import create_engine, select conn = create_engine("DB URL...").connect() q = select([huge_table]) proxy = conn....
Antonio Gamiz Delgado's user avatar
0 votes
1 answer
1k views

sqlmodel query with a subselect self join

Trying to do a self join on a model but am getting confused how to do so in sqlmodel ORM. Something equivalent to the use of following SQL in Postgresql. SELECT tt.id, ttp.parent_name, tt.name FROM ...
user1931485's user avatar
1 vote
1 answer
164 views

What's the best way to insert multiple rows in postgres from multithreaded Python application using SQLAlchemy?

I'm using SQLAlchemy to interact with postgres. Sometimes (on the highest request frequency) UniqueViolation exception is raising when I'm trying to insert rows in table. Here's the part of my code: ...
Kirill's user avatar
  • 11
0 votes
0 answers
274 views

Polymorphic issue with sqlAlchemy

Got the 'No such polymorphic_identity 0 is defined' error while doing this: My base class is class User(Base): id = Column(Integer, primary_key=True, index=True) email = Column(String, ...
William Bob's user avatar
0 votes
0 answers
178 views

Table Clobbered When Attempting Concurrent Writes - psycopg2.errors.SerializationFailure: could not serialize access due to concurrent update

I have uncovered a potential issue when writing to PostgreSQl using a custom upsert function using SQLAlchemy. In the event of concurrent writes one of the following errors are observed: psycopg2....
Eric North's user avatar
0 votes
1 answer
81 views

Using dockerfile and Docker Compose deploy app in debian droplet, however, PostgreSQL was not found

I followed this instruction for Docker part: Python CRUD Rest API using Flask, SQLAlchemy, Postgres, Docker, Docker Compose tried to use Dockerfile and Docker Compose file deploy app in debian droplet ...
Erik Johnsson's user avatar
0 votes
0 answers
28 views

SQLAlchemy syntax error when TRUNCATE TABLE [duplicate]

TRUNCATE TABLE my_table gives me syntax error from SQLAlchemy. I have seen other issues where the commit didn't occur, but this isn't the case. I really have no troubles with executing other queries ...
v.mascherini's user avatar

15 30 50 per page
1
2 3 4 5
15