Skip to content
Advertisement

Tag: sqlalchemy

SQLAlchemy engine.connect() fails for Snowflake using keypair authentication

My goal is to be able to write a pandas dataframe to Snowflake using the to_sql() function. I am able to successfuly query from Snowflake using read_sql() with no problems. It appears that to_sql() requires a slightly different configuration I can’t figure out. I’ve tried two different approaches that I’ve outlined below. I’m guessing, but could be wrong that the

I want to add data to my table using ORM in python

I want to add data in my database using ORM, and i am new to ORM in python. I am confused in SQLAlchemy and Flask-SQLAlchemy.”I tried this but don’t know how to proceed further Answer Flask-SqlAlchemy is commonly used for flask applications, otherwise just plain SqlAlchemy would should be enough. Flask-SqlAlchemy is a wrapper over SqlAlchemy and gives you following

sqlalchemy foreign key could not find table

I’m making a database using sqlalchemy which consists of three classes, User, Meeting, MeetingRoom I want to create a foreign key in Meeting for the Meeting room, but for some reason it gives the following error sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column ‘meeting.mrid’ could not find table ‘meetingroom’ with which to generate a foreign key to target column ‘mrid’ When

how flask-sqlalchemy turn off returning id while insert data

I’m trying to insert data to PostgreSQL 8.3.23 by Flask-SQLAlchemy==2.3.2, the errors show that INSERT statement is not supported in this version of Greenplum Database. so how can I turn off returning id in (flask-)sqlalchemy while insert. Thanks in advance Answer You need to set the implicit_returning create_engine parameter to False. When True, a RETURNING- compatible construct, if available, will

Connecting to Cloud SQL from Google Cloud Function using Python and SQLAlchemy

I read all documentation related to connecting to MysQL hosted in Cloud SQL from GCF and still can’t connect. Also, tried all hints in documentation of SQLAlchemy related to this. I am using the following connection The error I got was: (pymysql.err.OperationalError) (2003, “Can’t connect to MySQL server on ‘localhost’ ([Errno 111] Connection refused)”) (Background on this error at: http://sqlalche.me/e/e3q8)

How can I set model defaults based on a SqlAlchemy relationship?

Let’s say I have the following models: I would like to be able to default the Shipment.ship_date to be the day before the Treatment.treatment_date. In other words, I want to do the following: How do I set defaults based on relationships when they’re set dynamically by methods like append? For clarification, this is a question about SqlAlchemy and when relationships

SQLAlchemy nested model creation one-liner

I’m looking to create a new object from q2, which fails because the Question class is expecting options to be a dictionary of Options, and it’s receiving a dict of dicts instead. So, unpacking obviously fails with a nested model. What is the best approach to handle this? Is there something that’s equivalent to the elegance of the **dict for

Advertisement