[PonyORM-list] Использование CONCAT и других функций в выражении select

Alexander Kozlovsky alexander.kozlovsky at gmail.com
Mon Mar 31 20:00:12 UTC 2014


Здравствуйте.

В данный момент функция CONCAT не реализована, но возможно мы добавим ее в
ближайших релизах.

Сейчас для строк имеется операция +, но в данном случае она не сработает,
потому что день и месяц - числа а не строки.

В этом конкретном запросе проще вернуть из базы объект целиком, и получить
строковую комбинацию дня и месяца уже в Питоне, но для более сложных
запросов нам все же стоит добавить поддержку функции CONCAT.

---

At this moment, support of CONCAT function is not implemented yet, but
we'll probably add it in next releases.

Currently you can concatenate strings using + operation, but in this
particular query the date and the month are numbers, not strings.

I think that in this query it is simpler to return entire object from the
query and perform concatenation in Python, but it makes sense to add the
CONCAT operation support for more complex queries.



On Tue, Mar 18, 2014 at 6:57 PM, Данил Антонов <gzbender74 at gmail.com> wrote:

> Здравствуйте!
>
> Можно ли использовать в генераторах CONCAT по типу
> qs = orm.select(concat(ml.date.day, ml.date.month), ml.moderator.email,
> ml.moderation_type, ml.moderation_status, orm.count(ml))
>                 for ml in ModerationLog.p
>                 if date_from < ml.date and ml.date <=
> date_to).order_by('ml.date.day')
> ?
>
>
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.com
> /ponyorm-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20140401/7ac9a741/attachment.html>


More information about the ponyorm-list mailing list