diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-01-17 13:35:02 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-02-03 15:52:17 -0500 |
| commit | afcab5edf6a3a6e9e83d1940d0be079e92c53e79 (patch) | |
| tree | dcca718f11a4943b4e32ff0559fd67ad439c1dcf /lib/sqlalchemy/testing/suite | |
| parent | a7eeac60cae28bb553327d317a88adb22c799ef3 (diff) | |
| download | sqlalchemy-afcab5edf6a3a6e9e83d1940d0be079e92c53e79.tar.gz | |
Implement support for functions as FROM with columns clause support
Implemented support for "table valued functions" along with additional
syntaxes supported by PostgreSQL, one of the most commonly requested
features. Table valued functions are SQL functions that return lists of
values or rows, and are prevalent in PostgreSQL in the area of JSON
functions, where the "table value" is commonly referred towards as the
"record" datatype. Table valued functions are also supported by Oracle and
SQL Server.
Moved from I5b093b72533ef695293e737eb75850b9713e5e03 due
to accidental push
Fixes: #3566
Change-Id: Iea36d04c80a5ed3509dcdd9ebf0701687143fef5
Diffstat (limited to 'lib/sqlalchemy/testing/suite')
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_select.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_select.py b/lib/sqlalchemy/testing/suite/test_select.py index 0d9f08848..c6dacd423 100644 --- a/lib/sqlalchemy/testing/suite/test_select.py +++ b/lib/sqlalchemy/testing/suite/test_select.py @@ -32,6 +32,7 @@ from ... import true from ... import tuple_ from ... import union from ... import util +from ... import values from ...exc import DatabaseError from ...exc import ProgrammingError @@ -151,6 +152,22 @@ class OrderByLabelTest(fixtures.TablesTest): self._assert_result(stmt, [(1, 3), (1, 5), (1, 7)]) +class ValuesExpressionTest(fixtures.TestBase): + __requires__ = ("table_value_constructor",) + + __backend__ = True + + def test_tuples(self, connection): + value_expr = values( + column("id", Integer), column("name", String), name="my_values" + ).data([(1, "name1"), (2, "name2"), (3, "name3")]) + + eq_( + connection.execute(select(value_expr)).all(), + [(1, "name1"), (2, "name2"), (3, "name3")], + ) + + class FetchLimitOffsetTest(fixtures.TablesTest): __backend__ = True |
