All Questions
64 questions
1
vote
1
answer
796
views
Get primary key of inserted row after session.execute has run in python
I have a MS SQL table called reports with following structure. I want to get the row_id of the row that was just inserted:
r_id int NOT NULL IDENTITY,
report_type int,
report_source varchar,
...
0
votes
1
answer
153
views
search data based on date in sqlalchemy
i have a column(scheduledStartDateTime) in database which is of type datetime and i have to search previous row of data based on user entered datetime .
my query is like this:
order = self....
0
votes
0
answers
193
views
sql alchemy Update resultset of raw query
Am new to Sql Alchemy. I have a raw sql which i need to execute by passing bind parameters. Resulting rows from the query, i need to update a particular column value. How do i do this in the efficient ...
2
votes
1
answer
5k
views
Sqlalchemy convert epoch time to date in group by
I am using Sqlalchemy as ORM for PSQL db. My timestamps are stores as epoch times in my database eg, 1525868337991. (in milli sec)
I am writing a query to get count of employees on a particular date(...
1
vote
0
answers
311
views
Using SqlAlchemy models in a long running process
I'm coming from a PHP & Doctrine ORM background.
In doctrine orm, if I do a long running process like batch processing, it needs me to clear() the entity manager after processing some entities, to ...
0
votes
0
answers
44
views
How to determine one to one relationship? [duplicate]
I have the first Announcements model:
class Announcements(db.Model):
__tablename__ = 'announcements'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(150), nullable=...
1
vote
1
answer
2k
views
How to set timeouts of db calls using flask and SQLAlchemy?
I need to set timeout of db calls, and I looked into SQLAlchemy documentation http://flask-sqlalchemy.pocoo.org/2.1/config/
There are many configuration parameters, but never illustrate an example of ...
0
votes
0
answers
187
views
SQLAlchemy ORM ClauseElement select column 1, where column 2 in table 1
Very new to Flask, SQLAlchemy ORM and ClauseElement usage. Still not sure how to ask the question....
I'm trying to figure out what the equivalent would be for SQLAlchemy ORM? I've been through the ...
1
vote
1
answer
4k
views
python assignment to AppenderBaseQuery property in Flask-SQLAlchemy without effect
I have query selecting list of users from the database. Every user object has list of tags. This is set in the Tag model using this relationship:
users = db.relationship('User', secondary=user_tag, ...
1
vote
1
answer
4k
views
How to concatenate unrelated queries in SqlAlchemy
How can I concatenate sqlalchemy queries with no relation and sort by date?
e.g.
These are the models:
Human
Car
Tree
And they all have the column created. Here are the queries:
q1 = session.query(...
1
vote
0
answers
541
views
sqlalchemy dumps where is manage.py
I am trying to get alchemydumps to backup my database and am getting the following error when trying to run the alchemydumps create command. I think it is caused by a many to many relationship bug, ...
0
votes
2
answers
140
views
sqlalchemy claims column has unique requirement when it does not
I have the following model
models.py
class Rules(db.Model):
name=db.Column(db.String, primary_key=True)
rule=db.Column(db.Integer, default='0', unique=False)
def __repr__(self): # ...
1
vote
1
answer
151
views
sqlalchemy make columns follow relationship with rules
How do I get attr to be the name of the column being checked and value the value of the column being checked?
models.py
class Dates(db.Model):
username=db.Column(db.String, primary_key=True)
...
0
votes
1
answer
75
views
populate sqlalchemy from request.form without wtforms
Say I pull data from sqlalchemy via the following:
u=Mobility.query.filter_by(username=request.form.get('user')).first()
The Mobility class has 3 entries username(string), letter(string), date(...
0
votes
1
answer
82
views
sqlalchemy how to use metadata to build query
I can get my column names by doing
for c in models.User.__table__.column:
c.name
Now supposed I did the following:
users=models.User.query.all()
user=users[0]
for c in models.User.__table__.column:...