python - Is it possible to narrow down the generated query in SQLAlchemy if it was created via query_property? -


I have one more quick question about SQLite.

If I have to narrow the selected areas, in my SQLite table class in the [code> query_property [1] field?

What do I mean here

Suppose in my class comments is:

  class comments: query = Session.query_property () ...  

Then if I do the following:

  gt; & Gt; Print Sessions .Qiveer (Comment)  

Then SQLAlchemy generates the following query, which contains all the columns in my comments table:

 < Code> select comments.comment_id as comments_comment_id, comments.comment as comments_comment ... more columns ... from comments  

but I want to reduce this question and select only (let's say ), As the following creation:

  & gt; & Gt; & Gt; Print session. Select the comment (comment depression) Comment from comment comment comment comments  

Is it possible to do this through Comment.query ?

I tried the following but it does not work:

  & gt; & Gt; & Gt; Print Comment. Query (comment dot) traceback (most recent call final): File "& lt; stdin>", line 1, & lt; Module & gt; TypeError: The 'query' object is not worth the corner  

Please help me with a suggestion.

Thank you, Boda Cisco.

[1]

query.values ​​(Comment. Try to use . Note that this generator returns, there is no modified query, so this method should be called finally after applying all the filters.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -