Questions tagged [python]
Python is a powerful and ubiquitous language. When using a Python variant or library (e.g. Pandas, SQLAlchemy, pg8000, psycopg2), please include it in the tags. Questions using this tag should restrict themselves to interactions directly with the database tier. General python scripting questions should be directed to [StackOverflow](https://stackoverflow.com/questions/tagged/python)
277 questions
1
vote
1
answer
57
views
Safely update parts of JSON data stored in SQLite, OCC
So I’m experimenting with a lightweight way to track and safely update parts of JSON data stored in SQLite, using Python.
The main goal is to:
Keep JSON documents inside an SQLite database (in a TEXT ...
0
votes
0
answers
45
views
Using single Session vs multiple sessions for each request in FastAPI
I am building a fastapi project following a controller, manager and repo layers. My db connection and session is initialized and injected into each controller on the first request. It means my each ...
0
votes
0
answers
40
views
Prepared statements not working with Psycopg3 + PgBouncer (transaction pooling)
I'm running into unexpected behavior when trying to use prepared statements with TimescaleDB through PgBouncer in transaction pooling mode.
According to the Psycopg3 docs on prepared statements and ...
2
votes
1
answer
92
views
How to correctly store and retrieve timezone-aware timestamps in GridDB Cloud using Python without losing offset information?
I’m using GridDB Cloud with the Python client griddb_python and storing IoT event timestamps that are timezone-aware (e.g., UTC+05:30).
Example row insert:
import griddb_python as griddb
import ...
0
votes
1
answer
81
views
How to resolve an access issue while running SQL Server Agent to execute a Python?
I am trying to use SQL Server Agent to execute a Python file.
I am executing Python file using a Powershell script.
When I ran the SQL Server Agent job, error message says:
Message
Executed as user: ...
2
votes
1
answer
76
views
How to group by with similar group_name in sql
How can I perform a
GROUP BY
in SQL when the group_name values are similar but not exactly the same?
In my dataset, the group_name values may differ slightly (e.g., "Apple Inc.", "...
2
votes
1
answer
113
views
improve the implementation of worldquant 101 alpha factors using numpy
I was trying to implement 101 quant trading factors that was published by WorldQuant (https://arxiv.org/pdf/1601.00991.pdf).
A typical factor is about processing stocks' price and volume information ...
1
vote
3
answers
256
views
ERROR: invalid byte sequence for encoding "UTF8": 0xdc 0x36
When running a \copy (either pgadmin or aws_s3.table_import_from_s3) of a 1.6GB file into an AWS Aurora Postgres-compatible database, I'm getting the following error:
ERROR: invalid byte sequence for ...
0
votes
0
answers
71
views
How can I replicate data from a SQL Server VM in Azure to avoid recovery mode for reporting?
Currently, I'm using SQL Server on an Azure VM (DB B) to read from Power BI. DB B updates via log shipping from a primary SQL Server (DB A) and it locks me out from reading DB B two times an hour. I'...
0
votes
1
answer
52
views
Managing Feature Deletions and Triggers in SQLite with Python Integration (QGIS)
I am working with Spatialite layers on QGIS for a project that is also used by colleagues who are unfamiliar with SQLite, meaning they won’t be running SQLite queries themselves.
The issue I’m facing ...
0
votes
1
answer
290
views
Execute Python with Powershell in SQL Server 2019
I have been using SQL Server 2016's SQL Server Agent with bottom setting and script for last 3+ years. It was/is working fine.
But, now, I am migrating everything to SQL Server 2019, but the same ...
0
votes
0
answers
74
views
postgressql connection issues via python
I have a python code that runs simulations and writes the results to Postgres table. I have several machines on the network, But only the first one runs without any problems. other machines have ...
0
votes
1
answer
132
views
After upgrade Postgres python is the same version
I upgraded my postgres from 13.5 to 16.2 version (and the RHEL from 7.5 to 8.9).
The problem is, python was not upgraded.
I created procedure pyver():
CREATE OR REPLACE FUNCTION pyver ()
RETURNS TEXT
...
1
vote
0
answers
67
views
PostGres DB is read only in pgAdmin despite successful migration into it
I have an old MS Access Database that I want to migrate to a Postgres Db hosted in a Docker environment on a Windows Server.
I want to keep the MS Access Frontend, because it has some Forms and ...
0
votes
0
answers
339
views
Frequent MySql client error "got an error writing communication packets"
I have several different Linux servers running MySQL 8.0.x instances (ranging from 8.0.23 to 8.0.33).
I occasionally get "error writing communication packets" from clients when connecting to ...