Linked Questions
21 questions linked to/from SQLAlchemy IN clause
20
votes
2
answers
22k
views
filter with more than one value on flask-sqlalchemy [duplicate]
I want a query with multiple value like where id in (3,4,5)
Then I have a my_list = [3,4,5] so how can I pass that list as an argument to filter in sqlalchemy?
query = Notification.query.filter_by(...
-1
votes
1
answer
2k
views
SQLALCHEMY: filter result if a value is in a list [duplicate]
I have a list of values and I want to filter this sqlalchemy query based on if a value is in that list. Something like this:
def get_values(db: Session=
l = [23, 34, 54]
qr = db.query(table).filter(...
0
votes
1
answer
1k
views
How to get users from list of IDs in Flask [duplicate]
I am trying to create variable of users whose ID is in list but i dont know how. This is what I tried but it doesnt work. Does someone know how to filter it correctly?
list = [1, 2, 3, 4]
users = ...
2
votes
0
answers
133
views
SQLAlchemy : Querying a database column using elements from a given array [duplicate]
I have a problem with writing a Query using SQL ALchemy, I am running in Python 3.6.
I need to filter the content of a column in my SQLite Database using parameters contained in an array. So far I ...
9
votes
1
answer
5k
views
Using sqlalchemy to query using multiple column where in clause
I'm looking to execute this query using sqlalchemy.
SELECT name,
age,
favorite_color,
favorite_food
FROM kindergarten_classroom
WHERE (favorite_color,
favorite_food) IN ((...
2
votes
3
answers
21k
views
session.execute() IN operator of SQLAlchemy
I have one problem when i try to execute that simple request :
params['_filter_items'] = (12345)
sql = """ SELECT * FROM items
WHERE items.items IN %(_filter_items)s"""
# session is a db ...
1
vote
1
answer
4k
views
Flask SQLAlchemy: Selecting all rows with IDs from array
I'm using Flask-SQLAlchemy and I have a few tables from a database.
I'm trying to select all the rows with a specific id, to run a function. Right now I'm doing it using an if statement like this:
...
0
votes
1
answer
5k
views
SQLAlchemy - How to filter_by multiple dynamic OR values?
I have a pretty reasonable use case: Multiple possible filter_by matches for a single column. Basically, a multiselect JS dropdown on front end posts multiple company industries to the backend. I need ...
3
votes
2
answers
2k
views
SqlAlchemy filter_by with kwargs containing lists
I'm trying to build a filter statement from kwargs that may contain lists as values:
def delete_object(self, from_table, filters, commit=True):
(self._session
.query(from_table)
...
1
vote
1
answer
1k
views
Error with SQLAlchemy when query by list with "in_"
I keep receiving the error: sqlalchemy.exc.ArgumentError: Object 1 is not legal as a SQL literal value when executing this query:
cat_list = [1,2,3,4,5,6]
my_cats = Category.query.filter(Category.id....
0
votes
1
answer
1k
views
Using SQLAlchemy, can I join a Python object (i.e. a list) within a Query?
Assuming I have a Postgres-DB table looking like this (with with many more rows):
|------|-------|
|col1 |col 2 |
|------|-------|
|a1 |10 |
|a2 |55 |
|a3 |24 |
|------|-------|...
1
vote
1
answer
744
views
SQLAlchemy ORM update value by checking if other table value in list
I have a Kanji (Japanese characters) list which looks like:
kanji_n3 = ['政', '議', '民', '連'] # But then with 367 Kanji
and I have 2 tables: TableKanji and TableMisc. TableMisc has a column called '...
0
votes
1
answer
707
views
How to sort all the available users for booking in Flask?
I've created a small booking application where the client can book for a service, i've also made a form search where the client can search in a specific date to book.
The results should be all the ...
2
votes
0
answers
725
views
Check for multiple tasks using ExternalTaskSensor [closed]
I have a use case in which
Task A of DAG1 should run once the TASK B and TASK C of DAG2 are completed.
I am using ExternalTaskSensor, but to achieve this scenario I have to create two different ...
-1
votes
3
answers
367
views
how to pass variable with in operator in mysql?
In sql commed, where condition i'm using in operator along with a variable, now i've to pass value in this variable, what would be right syntax for this:
select col1 from testtable where col2 in :...