I don't know which database you are using, but in postgresql there
certainly is a function called "length" (see
http://www.postgresql.org/docs/9.1/static/functions-string.html)

On Thu, Dec 10, 2015 at 2:04 PM, SF Markus Elfring <
elfr...@users.sourceforge.net> wrote:

> > As stated in the docs:
> > "Note that any name not known to func generates the function name as is
> > - there is no restriction on what SQL functions can be called,
> > known or unknown to SQLAlchemy, built-in or user defined."
>
> I get an error message like "Function len(text) does not exist." if I try
> something out like the following on a string field.
>
> …
>       for length, \
>           incidence in session.query(func.len(position.label),
>                                      func.count(position.label)
>                                     ).group_by(func.len(position.label)) \
>                                      .order_by(func.len(position.label)):
> …
>
>
> Is it interesting that the following approach seems to work instead?
>
> …
>       for length, \
>           incidence in session.query(func.length(position.label),
>                                      func.count(position.label)
>
> ).group_by(func.length(position.label)) \
>
>  .order_by(func.length(position.label)):
> …
>
>
> How is the function "length" mapped to the SQL function "LEN"?
>
> 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.
>

-- 
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.

Reply via email to