Category "sqlalchemy"

SQLAlchemy implicit type conversion and Date validation

Let's assume this model class: class Person(db.Model): __tablename__ = "person" date_of_birth = db.Column(db.Date) With person being an instance of Pe

Set SQLAlchemy PickleType Column Size

I am trying to save a python list to an SQL table in a PickleType column which is defined in the class object as text = Column(PickleType). When I try to commit

Why is a closed session still usable?

Why is the session still available after closing? How can I close it correctly? @contextmanager def session_scope(): session = Session() try: yi

How do I change the schema for both a table and a foreign key?

I have the following simplified database access layer and two tables: class DataAccessLayer(): def __init__(self): conn_string = "mysql+mysqlconnect

SQLAlchemy group_concat ordered values

I want simulate the behaviour of collect_set in SQLAlchemy (using MySQL connector). i.e. group A 1,2,3 would be the same as 2,1,3. I have the following code: r

flask-sqlalchemy or sqlalchemy

I am new in both flask and sqlalchemy, I just start working on a flask app, and I am using sqlalchemy for now. I was wondering if there is any significant benef

How to use factory boy to test SQLalchemy association-object models?

I'm using the SQLalchemy association-object pattern (http://docs.sqlalchemy.org/en/rel_1_1/orm/basic_relationships.html#association-object) for three model clas

from . import models ImportError: attempted relative import with no known parent package

I am trying to create a database from SQLAlchemy. I am using Postgres as my database. When trying to create the database I get import error in from . import mod

from . import models ImportError: attempted relative import with no known parent package

I am trying to create a database from SQLAlchemy. I am using Postgres as my database. When trying to create the database I get import error in from . import mod

SQLAlchemy ORM conversion to pandas DataFrame

Is there a solution converting a SQLAlchemy <Query object> to a pandas DataFrame? Pandas has the capability to use pandas.read_sql but this requires use o

SQLAlchemy ORM conversion to pandas DataFrame

Is there a solution converting a SQLAlchemy <Query object> to a pandas DataFrame? Pandas has the capability to use pandas.read_sql but this requires use o

How to correctly structure SQLAlchemy (declarative style) python project and it`s unittests

I am developing large backend for some web apps. This is my first python and SQLAlchemy project, so I am confused with some things. And was kind of spoiled by J

How to write DataFrame to postgres table

There is DataFrame.to_sql method, but it works only for mysql, sqlite and oracle databases. I cant pass to this method postgres connection or sqlalchemy engine.

PyCharm warns about unexpected arguments for SQLAlchemy User model

I'm working with Flask-SQLAlchemy in PyCharm. When I try to create instances of my User model by passing keyword arguments to the model, PyCharm highlights the

How to query database by id using SqlAlchemy?

I need to query a SQLAlchemy database by its id something similar to User.query.filter_by(username='peter') but for id. How do I do this? [Searching over Googl

scoped_session(sessionmaker()) or plain sessionmaker() in sqlalchemy?

I am using SQlAlchemy in my web project. What should I use - scoped_session(sessionmaker()) or plain sessionmaker() - and why? Or should I use something else?

SQLAlchemy secondary relationship not using JOIN

I created a Many to Many relationship on SQLAlchemy, but for some reason when I access it it's not emitting a JOIN clause, but rather selecting from a cross pro