Here are the examples of the python api sqlalchemy.select.union taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
3
Example 1
Project: sqlalchemy Source File: test_insert.py
def test_insert_from_select_union(self):
mytable = self.tables.mytable
name = column('name')
description = column('desc')
sel = select(
[name, mytable.c.description],
).union(
select([name, description])
)
ins = mytable.insert().\
from_select(
[mytable.c.name, mytable.c.description], sel)
self.assert_compile(
ins,
"INSERT INTO mytable (name, description) "
"SELECT name, mytable.description FROM mytable "
'UNION SELECT name, "desc"'
)