[Sqlalchemy-tickets] Issue #3555: Extract a record's field (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
|
From: Andrey S. <iss...@bi...> - 2015-10-19 12:23:05
|
New issue 3555: Extract a record's field https://bitbucket.org/zzzeek/sqlalchemy/issues/3555/extract-a-records-field Andrey Semenov: I need to construct a query like ``` #!sql SELECT (jsonb_each('{"a": 1, "b": 2}')).key ``` `jsonb_each()` returns a RECORD type which in turn has it's own fields named `key` and `value`. Yes, in PostgreSQL it MUST be also wrapped into braces, because of extraction and executing precedence (or it will try to select a `key` column from the `jsonb_each()` column - that leads to SQL engine error raised). It's not obvious how to query those fields while constructing a query (or make a dot-notated reference to a custom sub-field when this capability is provided by an engine). Also, dialects.util.dottedgetter does not work with func.* (returns None if called against) |