Skip to content
Advertisement

Tag: sqlalchemy

Sqlalchemy in-memory database for MSSQL

I’m trying to setup tests for my project and want to use an in memory database for those tests. Based on some examples I found online I’ve been able to get an in memory sqlite database working… The problem I have is my models are all based around MSSQL (that’s what the ‘real’ code is using) so I get E

difference between autobegin and Session.begin

In the following code snippet a commit is executed once the with block is exited. As per the docs https://docs.sqlalchemy.org/en/20/orm/session_api.html#sqlalchemy.orm.Session.begin The Session object features autobegin behavior, so that normally it is not necessary to call the Session.begin() method explicitly Running without begin, like so does not commit even though the docs mention autobegin is not needed. The docs for Session.begin

Flask-SQLAlchemy Legacy vs New Query Interface

I am trying to update some queries in a web application because as stated in Flask-SQLAlchemy I have a query: Which is translated into: And I take the subnets variable and loop it over in my view in two different locations. And it works. However, when I try to update my query and use the new SQLAlchemy interface: I can

SQLAlchemy returns script parameters instead of script results

I’m trying to use SQLAlchemy 1.4 to query an Oracle database: This should return some kind of datetime object. When I execute this code (roughly) using SQLAlchemy, it decides to return the value of the :created_date parameter instead. Why is the result (literally) “blah”? EDIT:: See snakecharmerb’s answer below; you can’t bind column or table names with SQLAlchemy. It’s a

Flask admin – complex sort on hybrid_property

I have a fairly complex hybrid_property. This is a vendor model, which has multiple skuchannels (products). What it does is: Based on the target_stock_duration (e.g. we want to keep items in stock for 4 months) calculate how many units have to be ordered and how much this would cost. This gives us the potential. well this hybrid_property works just fine,

Advertisement