Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (19.9k points)

How do I make a request in the database - select id from user;

If I do this in the database, I get the list id:

id:

26c940a1-7228-4ea2-a3bc-e6460b172040

5597cc3d-c948-48a0-b711-393edf20d9c0

7badc8f8-65bc-449a-8cde-855234ac63e1

867f0924-a917-4711-939b-90b179a96392

1 Answer

0 votes
by (25.1k points)

Since you want a list of user id’s from a table called user, I am assuming that the class name is User, you can do it like this:

session.query(User.id).all()

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 12, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
asked Jul 2, 2020 in Python by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Jul 2, 2020 in Python by Sudhir_1997 (55.6k points)

Browse Categories

...