All Questions
Tagged with postgresql sqlalchemy
3,408
questions
0
votes
1
answer
32
views
automatic cleanup of postgres db after each test
I have sqlalchemy application that talks with a postgres db. I want to do some "integration tests" using testcontainers and trying the various scenarios.
just to make things simple, let's ...
-1
votes
1
answer
66
views
FastAPI Insert Performance: 1-2 ms Per Insert - Is This Normal?
I’m building a scalable FastAPI application with the goal of handling more than 10,000 requests per second (RPS). My application is quite complex. However, I’ve identified a significant bottleneck in ...
0
votes
0
answers
23
views
Different error codes (23503 vs 23502) when deleting a row in PostgreSQL using asyncpg
I'm encountering an issue when deleting a row in PostgreSQL with foreign key relationships.
Typically, this raises a ForeignKeyViolationError (23503), but when using asyncpg, I receive a ...
0
votes
0
answers
38
views
Handling timezone aware objects in SQLAlchemy with FastAPI
Whenever I query a column representing a timestamp with timezone data, it returns a UTC datetime. Even when I update the timezone of the session with SET TIMEZONE <>, the output remains in UTC. ...
3
votes
2
answers
55
views
the values of ENUM type in SQLAlchemy with PostgreSQL is the variable not the value?
so my problem is i am trying to make an enum with int values but it didn't work.
first of all, this is the code.
class UserRole(enum.IntEnum):
publisher = 4
editor = 3
manager = 2
...
0
votes
1
answer
48
views
Filtering JSON Field in PostgreSQL with SQLAlchemy
I'm working with a PostgreSQL database using SQLAlchemy in fastAPI, and I need to filter results based on a value in a JSON array column. However, I'm encountering an issue where the filter does not ...
0
votes
1
answer
61
views
Why cascade delete not working in PostgreSQL (SQLAlchemy)?
I'm trying to cascade-delete rows in table Product, but it is not working
seller_product = Table(
"seller_product",
Base.metadata,
Column("start_id", ...
0
votes
0
answers
27
views
PostgreSQL authentication fails on Ubuntu server until postgresql service is restarted
I am running a Flask app with SQLAlchemy, on Ubuntu server with PostgreSQL and Apache2.
SQLAlchemy gave an authentication failed for postgres error. After stopping Apache2, restarting Postgres and ...
-1
votes
1
answer
51
views
How do I convert an id = ANY(ARRAY(select ...)) to sqlalchemy
I have the following simplified query
WITH users as (
SELECT *
FROM users
WHERE created_at >= '2024-01-01'
)
SELECT *
FROM emails
WHERE user_id = ANY(ARRAY(SELECT id FROM users))
I need ...
-2
votes
0
answers
27
views
installing psycopg2 for SQLAlchemy , postgress running in docker connection [duplicate]
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, ...
1
vote
1
answer
49
views
SQLAlchemy Postrgresql XID type comparison
I have some code which protects from the concurrent updates using xmin value. In model it's mapped to the Integer like following
class MyTable(Base):
version = mapped_column(Integer, name="...
0
votes
0
answers
50
views
How can I load swiftly and asynchronously a pandas data frame into a PostGreSQL DB with SQL Alchemy?
My data frame has the same structure as the table in the DB. I used this function for the task until now:
async def upload_table_to_postgres_db(
session: AsyncSession, data: pd.DataFrame, ...
2
votes
1
answer
62
views
Get rows from related table (ORM object) via array_agg()
I want to get the product table data array using the array_agg function. In Postgers, this works great, but in SQLalchemy this can only be done with data types such as integer, strings, and so on. How ...
0
votes
1
answer
79
views
How to make modular architecture in FastAPI?
I have made a modular architecture in FastAPI and getting an error as shown below.
sub_department.py
from sqlalchemy import Column, String, Integer, ForeignKey
from sqlalchemy.orm import relationship
...
0
votes
1
answer
48
views
Postgres SQL Internal Server Error: Id seen as non-null
I'm trying to setup a post request with SQL Alchemy where I can update entries in a User table. I'm running into an issue where the user_id is violating the non_null constraint
The error:
(pg8000....