Files
sqlalchemy/test/profiling/compiler.py
T
Mike Bayer 69f7084c9b - merged inline inserts branch
- all executemany() style calls put all sequences and SQL defaults inline into a single SQL statement
and don't do any pre-execution
- regular Insert and Update objects can have inline=True, forcing all executions to be inlined.
- no last_inserted_ids(), lastrow_has_defaults() available with inline execution
- calculation of pre/post execute pushed into compiler; DefaultExecutionContext greatly simplified
- fixed postgres reflection of primary key columns with no sequence/default generator, sets autoincrement=False
- fixed postgres executemany() behavior regarding sequences present, not present, passivedefaults, etc.
- all tests pass for sqlite, mysql, postgres; oracle tests pass as well as they did previously including all
insert/update/default functionality
2007-09-01 19:49:26 +00:00

35 lines
997 B
Python

import testbase
from sqlalchemy import *
from testlib import *
class CompileTest(AssertMixin):
def setUpAll(self):
global t1, t2, metadata
metadata = MetaData()
t1 = Table('t1', metadata,
Column('c1', Integer, primary_key=True),
Column('c2', String(30)))
t2 = Table('t2', metadata,
Column('c1', Integer, primary_key=True),
Column('c2', String(30)))
@profiling.profiled('ctest_insert', call_range=(40, 50), always=True)
def test_insert(self):
t1.insert().compile()
@profiling.profiled('ctest_update', call_range=(40, 50), always=True)
def test_update(self):
t1.update().compile()
# TODO: this is alittle high
@profiling.profiled('ctest_select', call_range=(190, 210), always=True)
def test_select(self):
s = select([t1], t1.c.c2==t2.c.c1)
s.compile()
if __name__ == '__main__':
testbase.main()