[sqlalchemy] Selection of sort directions

2015-12-05 Thread SF Markus Elfring
Hello,

The software "SQLAlchemy" supports also the handling of the SQL clause "ORDER 
BY"
to some degree.
http://docs.sqlalchemy.org/en/rel_1_0/orm/query.html#sqlalchemy.orm.query.Query.order_by

Now I am looking for the corresponding description of details for
the specification of the desired sort criterion.
How should a "ascending" or "descending" direction be expressed as a parameter
for the query method "order_by"?

Regards,
Markus

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Determination of string lengths

2015-12-05 Thread SF Markus Elfring
Hello,

I would like to reuse the standard function "len" for the determination
of string lengths from specific database fields in a query.
http://www.dailyfreecode.com/code/len-function-296.aspx

Which interface does provide this functionality for the software "SQLAlchemy"?

Regards,
Markus

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Re: Selection of sort directions

2015-12-05 Thread Jonathan Vanasco
Odd- this isn't the narrative docs

You can use column attributes... 
 
(http://docs.sqlalchemy.org/en/latest/core/sqlelement.html#sqlalchemy.sql.expression.ColumnElement.desc)

session.query(model.Foo).order_by(model.Foo.id.desc())
session.query(model.Foo).order_by(model.Foo.id.asc())

session.query(model.Foo).order_by(model.Foo.id.desc(). 
model.Foo.id_b.asc())

There's also some sql expression in another 
package... 
http://docs.sqlalchemy.org/en/latest/core/sqlelement.html#sqlalchemy.sql.expression.desc

session.query(model.Foo).order_by(desc(model.Foo.id))

If you have a column the standard way is to just do `column.asc()`

Using the `desc(column)` syntax is really only necessary when using literal 
sql or very complex queries.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Determination of string lengths

2015-12-05 Thread Jeff Widman
This is probably the fastest answer:
http://stackoverflow.com/questions/15743121/how-to-filter-in-sqlalchemy-by-string-length
ᐧ

On Sat, Dec 5, 2015 at 1:34 AM, SF Markus Elfring <
elfr...@users.sourceforge.net> wrote:

> Hello,
>
> I would like to reuse the standard function "len" for the determination
> of string lengths from specific database fields in a query.
> http://www.dailyfreecode.com/code/len-function-296.aspx
>
> Which interface does provide this functionality for the software
> "SQLAlchemy"?
>
> Regards,
> Markus
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

*Jeff Widman*
jeffwidman.com  | 740-WIDMAN-J (943-6265)
<><

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.