Category "sqlalchemy"

in many-to-many relationships, can you delete a row from one table without deleting any rows from the second table?

I am creating a database & working on CRUD functions. I've run into a problem with the Delete functionality. I have two tables, connected in a many-to-many

How to connect and query MySQL DB from python shell job in AWS Glue

I was using sqlalchemy to create connection and query mySQL DB, however, glue doesn't seem to support "sqlalchemy" or even "pymysql". Is there a way to do this

GeoPandas.GeoDataFrame: type "geometry" does not exist

Ubuntu 20.04.3 LTS (WSL2) fiona 1.8.21 geopandas 0.10.2 geopandas-base 0.10.2 geopy

psycopg2.OperationalError: could not translate host name "<address>" to address: Temporary failure in name resolution

I have looked through similar posts on SO and they seem to be specific to using Docker environments and haven't been much helpful. Ours is a little different, w

Table metadata transfer from sqlserver to postgresql using SQLAlchemy

I am trying to migrate my database from ms sql server to PostgreSQL using python script . Before migrating the data, script needs to create required tables. I i

Can I pass a dict to where() in SQLAlchemy?

Rather than selecting rows by a static set of columns, e.g. stmt = select(User).where(and_(User.first_name == 'foo', User.last_name == 'bar')) I would like to

AttributeError: __aenter__

I'm trying to make a bulk update in my database. Using aiohtpp + sqlachemy. I'm getting a error async with sess.begin(): AttributeError: __aenter__ with th

sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres

I'm trying to connect to a Postgres database with SQLAlchemy. I've installed psycopg2. However, I get the error sqlalchemy.exc.NoSuchModuleError: Can't load plu

SQLAlchemy: Using sessionmaker as contextmanger forces to expunge manually

I'm using SQLAlchemy and trying to use the sessionmaker as a context manager for my transaction (following the documentation): Session = sessionmaker(some_engin

Column Inheritance for Independent ORM Mapper Classes In SQL Alchemy

I am trying to replicate the following SQLite CREATE TABLE statements using the declarative ORM mapper classes in SQLALchemy. CREATE TABLE IF NOT EXISTS questio

SQLAlchemy: JOIN between different databases AND using different files in a module

Stack I am using: Python 3.10.x FastAPI 0.75.x SQLAlchemy 1.4.3x Summary I am building a unifying FastAPI project for several legacy databases (stored back-end

python can't find sqlalchemy

So I'm trying to run a python application that I did not make but I need to make it run and I don't want to edit the huge spaghetti code in here. It was made se

How to make null/none count 0 instead?

I have some sqlalchemy that counts rows with the value "3" and then prints out the count. It works fine if the count is 1, 2, 3, etc, but when there are no item

panda df not showing all rows after loading from MS SQL

I'm using Pandas with latest sqlalchemy (1.4.36) to query a MS SQL DB, using the following Python 3.10.3 [Win] snippet: import pandas as pd

How does a session work with SQL Alchemy with pool?

engine = db.create_engine(self.url, convert_unicode=True, pool_size=5, pool_recycle=1800, max_overflow=10) connection = self.engine.connect() Session = scoped

What is the best way to mock disconnect within SQLAlchemy

I write tests for CRUD application and i want to be sure that its behaviour is correct during different scenarios when connection to DB permanently or temporari

Error with delimiters on dataframe when trying to upload it to MSSQL

So I've been trying to upload a dataframe to an specific table that is under MSSQL, I've trying to use the BCPANDAS library to upload the data to it. However th

Create a hybrid_property to return the value of a previous record

I've got as far as this when trying to create a hybrid_property to return the value of the previous record: from datetime import date from sqlalchemy import Col

PendingRollbackError when accessing test database in FastAPI async test

I'm trying to mimic Django behavior when running tests on FastAPI: I want to create a test database in the beginning of each test, and destroy it in the end. Th

m1 macos can't install hdbcli

I have a script that starts with import pandas as pd from sqlalchemy import create_engine, text hana_engine = create_engine(os.getenv('RCF_HANA_URI'), echo=Fal