# -*- encoding: utf-8
from sqlalchemy.testing import eq_, is_
from sqlalchemy import schema
from sqlalchemy.sql import table, column, quoted_name
from sqlalchemy.dialects import mssql
from sqlalchemy.dialects.mssql import mxodbc
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy import sql
from sqlalchemy import Integer, String, Table, Column, select, MetaData,\
    update, delete, insert, extract, union, func, PrimaryKeyConstraint, \
    UniqueConstraint, Index, Sequence, literal
from sqlalchemy import testing
from sqlalchemy.dialects.mssql import base


class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
    __dialect__ = mssql.dialect()

    def test_true_false(self):
        self.assert_compile(
            sql.false(), "0"
        )
        self.assert_compile(
            sql.true(),
            "1"
        )

    def test_select(self):
        t = table('sometable', column('somecolumn'))
        self.assert_compile(t.select(),
                            'SELECT sometable.somecolumn FROM sometable')

    def test_select_with_nolock(self):
        t = table('sometable', column('somecolumn'))
        self.assert_compile(
            t.select().with_hint(t, 'WITH (NOLOCK)'),
            'SELECT sometable.somecolumn FROM sometable WITH (NOLOCK)')

    def test_select_with_nolock_schema(self):
        m = MetaData()
        t = Table('sometable', m, Column('somecolumn', Integer),
                  schema='test_schema')
        self.assert_compile(
            t.select().with_hint(t, 'WITH (NOLOCK)'),
            'SELECT test_schema.sometable.somecolumn '
            'FROM test_schema.sometable WITH (NOLOCK)')

    def test_select_w_order_by_collate(self):
        m = MetaData()
        t = Table('sometable', m, Column('somecolumn', String))

        self.assert_compile(
            select([t]).
            order_by(
                t.c.somecolumn.collate("Latin1_General_CS_AS_KS_WS_CI").asc()),
            "SELECT sometable.somecolumn FROM sometable "
            "ORDER BY sometable.somecolumn COLLATE "
            "Latin1_General_CS_AS_KS_WS_CI ASC"

        )

    def test_join_with_hint(self):
        t1 = table('t1',
                   column('a', Integer),
                   column('b', String),
                   column('c', String),
                   )
        t2 = table('t2',
                   column("a", Integer),
                   column("b", Integer),
                   column("c", Integer),
                   )
        join = t1.join(t2, t1.c.a == t2.c.a).\
            select().with_hint(t1, 'WITH (NOLOCK)')
        self.assert_compile(
            join,
            'SELECT t1.a, t1.b, t1.c, t2.a, t2.b, t2.c '
            'FROM t1 WITH (NOLOCK) JOIN t2 ON t1.a = t2.a'
        )

    def test_insert(self):
        t = table('sometable', column('somecolumn'))
        self.assert_compile(t.insert(),
                            'INSERT INTO sometable (somecolumn) VALUES '
                            '(:somecolumn)')

    def test_update(self):
        t = table('sometable', column('somecolumn'))
        self.assert_compile(t.update(t.c.somecolumn == 7),
                            'UPDATE sometable SET somecolumn=:somecolum'
                            'n WHERE sometable.somecolumn = '
                            ':somecolumn_1', dict(somecolumn=10))

    def test_insert_hint(self):
        t = table('sometable', column('somecolumn'))
        for targ in (None, t):
            for darg in ("*", "mssql"):
                self.assert_compile(
                    t.insert().
                    values(somecolumn="x").
                    with_hint("WITH (PAGLOCK)",
                              selectable=targ,
                              dialect_name=darg),
                    "INSERT INTO sometable WITH (PAGLOCK) "
                    "(somecolumn) VALUES (:somecolumn)"
                )

    def test_update_hint(self):
        t = table('sometable', column('somecolumn'))
        for targ in (None, t):
            for darg in ("*", "mssql"):
                self.assert_compile(
                    t.update().where(t.c.somecolumn == "q").
                    values(somecolumn="x").
                    with_hint("WITH (PAGLOCK)",
                              selectable=targ,
                              dialect_name=darg),
                    "UPDATE sometable WITH (PAGLOCK) "
                    "SET somecolumn=:somecolumn "
                    "WHERE sometable.somecolumn = :somecolumn_1"
                )

    def test_update_exclude_hint(self):
        t = table('sometable', column('somecolumn'))
        self.assert_compile(
            t.update().where(t.c.somecolumn == "q").
            values(somecolumn="x").
            with_hint("XYZ", "mysql"),
            "UPDATE sometable SET somecolumn=:somecolumn "
            "WHERE sometable.somecolumn = :somecolumn_1"
        )

    def test_delete_hint(self):
        t = table('sometable', column('somecolumn'))
        for targ in (None, t):
            for darg in ("*", "mssql"):
                self.assert_compile(
                    t.delete().where(t.c.somecolumn == "q").
                    with_hint("WITH (PAGLOCK)",
                              selectable=targ,
                              dialect_name=darg),
                    "DELETE FROM sometable WITH (PAGLOCK) "
                    "WHERE sometable.somecolumn = :somecolumn_1"
                )

    def test_delete_exclude_hint(self):
        t = table('sometable', column('somecolumn'))
        self.assert_compile(
            t.delete().
            where(t.c.somecolumn == "q").
            with_hint("XYZ", dialect_name="mysql"),
            "DELETE FROM sometable WHERE "
            "sometable.somecolumn = :somecolumn_1"
        )

    def test_delete_extra_froms(self):
        t1 = table('t1', column('c1'))
        t2 = table('t2', column('c1'))
        q = sql.delete(t1).where(t1.c.c1 == t2.c.c1)
        self.assert_compile(
            q, "DELETE FROM t1 FROM t1, t2 WHERE t1.c1 = t2.c1"
        )

    def test_delete_extra_froms_alias(self):
        a1 = table('t1', column('c1')).alias('a1')
        t2 = table('t2', column('c1'))
        q = sql.delete(a1).where(a1.c.c1 == t2.c.c1)
        self.assert_compile(
            q, "DELETE FROM a1 FROM t1 AS a1, t2 WHERE a1.c1 = t2.c1"
        )
        self.assert_compile(sql.delete(a1), "DELETE FROM t1 AS a1")

    def test_update_from_hint(self):
        t = table('sometable', column('somecolumn'))
        t2 = table('othertable', column('somecolumn'))
        for darg in ("*", "mssql"):
            self.assert_compile(
                t.update().where(t.c.somecolumn == t2.c.somecolumn).
                values(somecolumn="x").
                with_hint("WITH (PAGLOCK)",
                          selectable=t2,
                          dialect_name=darg),
                "UPDATE sometable SET somecolumn=:somecolumn "
                "FROM sometable, othertable WITH (PAGLOCK) "
                "WHERE sometable.somecolumn = othertable.somecolumn"
            )

    def test_update_to_select_schema(self):
        meta = MetaData()
        table = Table(
            "sometable", meta,
            Column("sym", String),
            Column("val", Integer),
            schema="schema"
        )
        other = Table(
            "#other", meta,
            Column("sym", String),
            Column("newval", Integer)
        )
        stmt = table.update().values(
            val=select([other.c.newval]).
            where(table.c.sym == other.c.sym).as_scalar())

        self.assert_compile(
            stmt,
            "UPDATE [schema].sometable SET val="
            "(SELECT [#other].newval FROM [#other] "
            "WHERE [schema].sometable.sym = [#other].sym)",
        )

        stmt = table.update().values(val=other.c.newval).\
            where(table.c.sym == other.c.sym)
        self.assert_compile(
            stmt,
            "UPDATE [schema].sometable SET val="
            "[#other].newval FROM [schema].sometable, "
            "[#other] WHERE [schema].sometable.sym = [#other].sym",
        )

    # TODO: not supported yet.
    # def test_delete_from_hint(self):
    #    t = table('sometable', column('somecolumn'))
    #    t2 = table('othertable', column('somecolumn'))
    #    for darg in ("*", "mssql"):
    #        self.assert_compile(
    #            t.delete().where(t.c.somecolumn==t2.c.somecolumn).
    #                    with_hint("WITH (PAGLOCK)",
    #                            selectable=t2,
    #                            dialect_name=darg),
    #            ""
    #        )

    def test_strict_binds(self):
        """test the 'strict' compiler binds."""

        from sqlalchemy.dialects.mssql.base import MSSQLStrictCompiler
        mxodbc_dialect = mxodbc.dialect()
        mxodbc_dialect.statement_compiler = MSSQLStrictCompiler

        t = table('sometable', column('foo'))

        for expr, compile in [
            (
                select([literal("x"), literal("y")]),
                "SELECT 'x' AS anon_1, 'y' AS anon_2",
            ),
            (
                select([t]).where(t.c.foo.in_(['x', 'y', 'z'])),
                "SELECT sometable.foo FROM sometable WHERE sometable.foo "
                "IN ('x', 'y', 'z')",
            ),
            (
                t.c.foo.in_([None]),
                "sometable.foo IN (NULL)"
            )
        ]:
            self.assert_compile(expr, compile, dialect=mxodbc_dialect)

    def test_in_with_subqueries(self):
        """Test removal of legacy behavior that converted "x==subquery"
        to use IN.

        """

        t = table('sometable', column('somecolumn'))
        self.assert_compile(t.select().where(t.c.somecolumn
                                             == t.select()),
                            'SELECT sometable.somecolumn FROM '
                            'sometable WHERE sometable.somecolumn = '
                            '(SELECT sometable.somecolumn FROM '
                            'sometable)')
        self.assert_compile(t.select().where(t.c.somecolumn
                                             != t.select()),
                            'SELECT sometable.somecolumn FROM '
                            'sometable WHERE sometable.somecolumn != '
                            '(SELECT sometable.somecolumn FROM '
                            'sometable)')

    @testing.uses_deprecated
    def test_count(self):
        t = table('sometable', column('somecolumn'))
        self.assert_compile(t.count(),
                            'SELECT count(sometable.somecolumn) AS '
                            'tbl_row_count FROM sometable')

    def test_noorderby_insubquery(self):
        """test that the ms-sql dialect removes ORDER BY clauses from
        subqueries"""

        table1 = table('mytable',
                       column('myid', Integer),
                       column('name', String),
                       column('description', String),
                       )

        q = select([table1.c.myid],
                   order_by=[table1.c.myid]).alias('foo')
        crit = q.c.myid == table1.c.myid
        self.assert_compile(select(['*'], crit),
                            "SELECT * FROM (SELECT mytable.myid AS "
                            "myid FROM mytable) AS foo, mytable WHERE "
                            "foo.myid = mytable.myid")

    def test_force_schema_quoted_name_w_dot_case_insensitive(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('id', Integer, primary_key=True),
            schema=quoted_name("foo.dbo", True)
        )
        self.assert_compile(
            select([tbl]),
            "SELECT [foo.dbo].test.id FROM [foo.dbo].test"
        )

    def test_force_schema_quoted_w_dot_case_insensitive(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('id', Integer, primary_key=True),
            schema=quoted_name("foo.dbo", True)
        )
        self.assert_compile(
            select([tbl]),
            "SELECT [foo.dbo].test.id FROM [foo.dbo].test"
        )

    def test_force_schema_quoted_name_w_dot_case_sensitive(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('id', Integer, primary_key=True),
            schema=quoted_name("Foo.dbo", True)
        )
        self.assert_compile(
            select([tbl]),
            "SELECT [Foo.dbo].test.id FROM [Foo.dbo].test"
        )

    def test_force_schema_quoted_w_dot_case_sensitive(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('id', Integer, primary_key=True),
            schema="[Foo.dbo]"
        )
        self.assert_compile(
            select([tbl]),
            "SELECT [Foo.dbo].test.id FROM [Foo.dbo].test"
        )

    def test_schema_autosplit_w_dot_case_insensitive(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('id', Integer, primary_key=True),
            schema="foo.dbo"
        )
        self.assert_compile(
            select([tbl]),
            "SELECT foo.dbo.test.id FROM foo.dbo.test"
        )

    def test_schema_autosplit_w_dot_case_sensitive(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('id', Integer, primary_key=True),
            schema="Foo.dbo"
        )
        self.assert_compile(
            select([tbl]),
            "SELECT [Foo].dbo.test.id FROM [Foo].dbo.test"
        )

    def test_owner_database_pairs(self):
        dialect = mssql.dialect()

        for identifier, expected_schema, expected_owner in [
            ("foo", None, "foo"),
            ("foo.bar", "foo", "bar"),
            ("Foo.Bar", "Foo", "Bar"),
            ("[Foo.Bar]", None, "Foo.Bar"),
            ("[Foo.Bar].[bat]", "Foo.Bar", "bat"),
        ]:
            schema, owner = base._owner_plus_db(dialect, identifier)

            eq_(owner, expected_owner)
            eq_(schema, expected_schema)

    def test_delete_schema(self):
        metadata = MetaData()
        tbl = Table('test', metadata, Column('id', Integer,
                                             primary_key=True), schema='paj')
        self.assert_compile(tbl.delete(tbl.c.id == 1),
                            'DELETE FROM paj.test WHERE paj.test.id = '
                            ':id_1')
        s = select([tbl.c.id]).where(tbl.c.id == 1)
        self.assert_compile(tbl.delete().where(tbl.c.id.in_(s)),
                            'DELETE FROM paj.test WHERE paj.test.id IN '
                            '(SELECT paj.test.id FROM paj.test '
                            'WHERE paj.test.id = :id_1)')

    def test_delete_schema_multipart(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('id', Integer,
                   primary_key=True),
            schema='banana.paj')
        self.assert_compile(tbl.delete(tbl.c.id == 1),
                            'DELETE FROM banana.paj.test WHERE '
                            'banana.paj.test.id = :id_1')
        s = select([tbl.c.id]).where(tbl.c.id == 1)
        self.assert_compile(tbl.delete().where(tbl.c.id.in_(s)),
                            'DELETE FROM banana.paj.test WHERE '
                            'banana.paj.test.id IN (SELECT banana.paj.test.id '
                            'FROM banana.paj.test WHERE '
                            'banana.paj.test.id = :id_1)')

    def test_delete_schema_multipart_needs_quoting(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('id', Integer, primary_key=True),
            schema='banana split.paj')
        self.assert_compile(tbl.delete(tbl.c.id == 1),
                            'DELETE FROM [banana split].paj.test WHERE '
                            '[banana split].paj.test.id = :id_1')
        s = select([tbl.c.id]).where(tbl.c.id == 1)
        self.assert_compile(tbl.delete().where(tbl.c.id.in_(s)),
                            'DELETE FROM [banana split].paj.test WHERE '
                            '[banana split].paj.test.id IN ('

                            'SELECT [banana split].paj.test.id FROM '
                            '[banana split].paj.test WHERE '
                            '[banana split].paj.test.id = :id_1)')

    def test_delete_schema_multipart_both_need_quoting(self):
        metadata = MetaData()
        tbl = Table('test', metadata, Column('id', Integer,
                                             primary_key=True),
                    schema='banana split.paj with a space')
        self.assert_compile(tbl.delete(tbl.c.id == 1),
                            'DELETE FROM [banana split].[paj with a '
                            'space].test WHERE [banana split].[paj '
                            'with a space].test.id = :id_1')
        s = select([tbl.c.id]).where(tbl.c.id == 1)
        self.assert_compile(
            tbl.delete().where(tbl.c.id.in_(s)),
            "DELETE FROM [banana split].[paj with a space].test "
            "WHERE [banana split].[paj with a space].test.id IN "
            "(SELECT [banana split].[paj with a space].test.id "
            "FROM [banana split].[paj with a space].test "
            "WHERE [banana split].[paj with a space].test.id = :id_1)"
        )

    def test_union(self):
        t1 = table(
            't1', column('col1'), column('col2'),
            column('col3'), column('col4'))
        t2 = table(
            't2', column('col1'), column('col2'),
            column('col3'), column('col4'))
        s1, s2 = select(
            [t1.c.col3.label('col3'), t1.c.col4.label('col4')],
            t1.c.col2.in_(['t1col2r1', 't1col2r2'])), \
            select([t2.c.col3.label('col3'), t2.c.col4.label('col4')],
                   t2.c.col2.in_(['t2col2r2', 't2col2r3']))
        u = union(s1, s2, order_by=['col3', 'col4'])
        self.assert_compile(u,
                            'SELECT t1.col3 AS col3, t1.col4 AS col4 '
                            'FROM t1 WHERE t1.col2 IN (:col2_1, '
                            ':col2_2) UNION SELECT t2.col3 AS col3, '
                            't2.col4 AS col4 FROM t2 WHERE t2.col2 IN '
                            '(:col2_3, :col2_4) ORDER BY col3, col4')
        self.assert_compile(u.alias('bar').select(),
                            'SELECT bar.col3, bar.col4 FROM (SELECT '
                            't1.col3 AS col3, t1.col4 AS col4 FROM t1 '
                            'WHERE t1.col2 IN (:col2_1, :col2_2) UNION '
                            'SELECT t2.col3 AS col3, t2.col4 AS col4 '
                            'FROM t2 WHERE t2.col2 IN (:col2_3, '
                            ':col2_4)) AS bar')

    def test_function(self):
        self.assert_compile(func.foo(1, 2), 'foo(:foo_1, :foo_2)')
        self.assert_compile(func.current_time(), 'CURRENT_TIME')
        self.assert_compile(func.foo(), 'foo()')
        m = MetaData()
        t = Table(
            'sometable', m, Column('col1', Integer), Column('col2', Integer))
        self.assert_compile(select([func.max(t.c.col1)]),
                            'SELECT max(sometable.col1) AS max_1 FROM '
                            'sometable')

    def test_function_overrides(self):
        self.assert_compile(func.current_date(), "GETDATE()")
        self.assert_compile(func.length(3), "LEN(:length_1)")

    def test_extract(self):
        t = table('t', column('col1'))

        for field in 'day', 'month', 'year':
            self.assert_compile(
                select([extract(field, t.c.col1)]),
                'SELECT DATEPART(%s, t.col1) AS anon_1 FROM t' % field)

    def test_update_returning(self):
        table1 = table(
            'mytable',
            column('myid', Integer),
            column('name', String(128)),
            column('description', String(128)))
        u = update(
            table1,
            values=dict(name='foo')).returning(table1.c.myid, table1.c.name)
        self.assert_compile(u,
                            'UPDATE mytable SET name=:name OUTPUT '
                            'inserted.myid, inserted.name')
        u = update(table1, values=dict(name='foo')).returning(table1)
        self.assert_compile(u,
                            'UPDATE mytable SET name=:name OUTPUT '
                            'inserted.myid, inserted.name, '
                            'inserted.description')
        u = update(
            table1,
            values=dict(
                name='foo')).returning(table1).where(table1.c.name == 'bar')
        self.assert_compile(u,
                            'UPDATE mytable SET name=:name OUTPUT '
                            'inserted.myid, inserted.name, '
                            'inserted.description WHERE mytable.name = '
                            ':name_1')
        u = update(table1, values=dict(name='foo'
                                       )).returning(func.length(table1.c.name))
        self.assert_compile(u,
                            'UPDATE mytable SET name=:name OUTPUT '
                            'LEN(inserted.name) AS length_1')

    def test_delete_returning(self):
        table1 = table(
            'mytable', column('myid', Integer),
            column('name', String(128)), column('description', String(128)))
        d = delete(table1).returning(table1.c.myid, table1.c.name)
        self.assert_compile(d,
                            'DELETE FROM mytable OUTPUT deleted.myid, '
                            'deleted.name')
        d = delete(table1).where(table1.c.name == 'bar'
                                 ).returning(table1.c.myid,
                                             table1.c.name)
        self.assert_compile(d,
                            'DELETE FROM mytable OUTPUT deleted.myid, '
                            'deleted.name WHERE mytable.name = :name_1')

    def test_insert_returning(self):
        table1 = table(
            'mytable', column('myid', Integer),
            column('name', String(128)), column('description', String(128)))
        i = insert(
            table1,
            values=dict(name='foo')).returning(table1.c.myid, table1.c.name)
        self.assert_compile(i,
                            'INSERT INTO mytable (name) OUTPUT '
                            'inserted.myid, inserted.name VALUES '
                            '(:name)')
        i = insert(table1, values=dict(name='foo')).returning(table1)
        self.assert_compile(i,
                            'INSERT INTO mytable (name) OUTPUT '
                            'inserted.myid, inserted.name, '
                            'inserted.description VALUES (:name)')
        i = insert(table1, values=dict(name='foo'
                                       )).returning(func.length(table1.c.name))
        self.assert_compile(i,
                            'INSERT INTO mytable (name) OUTPUT '
                            'LEN(inserted.name) AS length_1 VALUES '
                            '(:name)')

    def test_limit_using_top(self):
        t = table('t', column('x', Integer), column('y', Integer))

        s = select([t]).where(t.c.x == 5).order_by(t.c.y).limit(10)

        self.assert_compile(
            s,
            "SELECT TOP 10 t.x, t.y FROM t WHERE t.x = :x_1 ORDER BY t.y",
            checkparams={'x_1': 5}
        )

    def test_limit_zero_using_top(self):
        t = table('t', column('x', Integer), column('y', Integer))

        s = select([t]).where(t.c.x == 5).order_by(t.c.y).limit(0)

        self.assert_compile(
            s,
            "SELECT TOP 0 t.x, t.y FROM t WHERE t.x = :x_1 ORDER BY t.y",
            checkparams={'x_1': 5}
        )
        c = s.compile(dialect=mssql.dialect())
        eq_(len(c._result_columns), 2)
        assert t.c.x in set(c._create_result_map()['x'][1])

    def test_offset_using_window(self):
        t = table('t', column('x', Integer), column('y', Integer))

        s = select([t]).where(t.c.x == 5).order_by(t.c.y).offset(20)

        # test that the select is not altered with subsequent compile
        # calls
        for i in range(2):
            self.assert_compile(
                s,
                "SELECT anon_1.x, anon_1.y FROM (SELECT t.x AS x, t.y "
                "AS y, ROW_NUMBER() OVER (ORDER BY t.y) AS "
                "mssql_rn FROM t WHERE t.x = :x_1) AS "
                "anon_1 WHERE mssql_rn > :param_1",
                checkparams={'param_1': 20, 'x_1': 5}
            )

            c = s.compile(dialect=mssql.dialect())
            eq_(len(c._result_columns), 2)
            assert t.c.x in set(c._create_result_map()['x'][1])

    def test_limit_offset_using_window(self):
        t = table('t', column('x', Integer), column('y', Integer))

        s = select([t]).where(t.c.x == 5).order_by(t.c.y).limit(10).offset(20)

        self.assert_compile(
            s,
            "SELECT anon_1.x, anon_1.y "
            "FROM (SELECT t.x AS x, t.y AS y, "
            "ROW_NUMBER() OVER (ORDER BY t.y) AS mssql_rn "
            "FROM t "
            "WHERE t.x = :x_1) AS anon_1 "
            "WHERE mssql_rn > :param_1 AND mssql_rn <= :param_2 + :param_1",
            checkparams={'param_1': 20, 'param_2': 10, 'x_1': 5}
        )
        c = s.compile(dialect=mssql.dialect())
        eq_(len(c._result_columns), 2)
        assert t.c.x in set(c._create_result_map()['x'][1])
        assert t.c.y in set(c._create_result_map()['y'][1])

    def test_limit_offset_w_ambiguous_cols(self):
        t = table('t', column('x', Integer), column('y', Integer))

        cols = [t.c.x, t.c.x.label('q'), t.c.x.label('p'), t.c.y]
        s = select(cols).where(t.c.x == 5).order_by(t.c.y).limit(10).offset(20)

        self.assert_compile(
            s,
            "SELECT anon_1.x, anon_1.q, anon_1.p, anon_1.y "
            "FROM (SELECT t.x AS x, t.x AS q, t.x AS p, t.y AS y, "
            "ROW_NUMBER() OVER (ORDER BY t.y) AS mssql_rn "
            "FROM t "
            "WHERE t.x = :x_1) AS anon_1 "
            "WHERE mssql_rn > :param_1 AND mssql_rn <= :param_2 + :param_1",
            checkparams={'param_1': 20, 'param_2': 10, 'x_1': 5}
        )
        c = s.compile(dialect=mssql.dialect())
        eq_(len(c._result_columns), 4)

        result_map = c._create_result_map()

        for col in cols:
            is_(result_map[col.key][1][0], col)

    def test_limit_offset_with_correlated_order_by(self):
        t1 = table('t1', column('x', Integer), column('y', Integer))
        t2 = table('t2', column('x', Integer), column('y', Integer))

        order_by = select([t2.c.y]).where(t1.c.x == t2.c.x).as_scalar()
        s = select([t1]).where(t1.c.x == 5).order_by(order_by) \
            .limit(10).offset(20)

        self.assert_compile(
            s,
            "SELECT anon_1.x, anon_1.y "
            "FROM (SELECT t1.x AS x, t1.y AS y, "
            "ROW_NUMBER() OVER (ORDER BY "
            "(SELECT t2.y FROM t2 WHERE t1.x = t2.x)"
            ") AS mssql_rn "
            "FROM t1 "
            "WHERE t1.x = :x_1) AS anon_1 "
            "WHERE mssql_rn > :param_1 AND mssql_rn <= :param_2 + :param_1",
            checkparams={'param_1': 20, 'param_2': 10, 'x_1': 5}
        )

        c = s.compile(dialect=mssql.dialect())
        eq_(len(c._result_columns), 2)
        assert t1.c.x in set(c._create_result_map()['x'][1])
        assert t1.c.y in set(c._create_result_map()['y'][1])

    def test_offset_dont_misapply_labelreference(self):
        m = MetaData()

        t = Table('t', m, Column('x', Integer))

        expr1 = func.foo(t.c.x).label('x')
        expr2 = func.foo(t.c.x).label('y')

        stmt1 = select([expr1]).order_by(expr1.desc()).offset(1)
        stmt2 = select([expr2]).order_by(expr2.desc()).offset(1)

        self.assert_compile(
            stmt1,
            "SELECT anon_1.x FROM (SELECT foo(t.x) AS x, "
            "ROW_NUMBER() OVER (ORDER BY foo(t.x) DESC) AS mssql_rn FROM t) "
            "AS anon_1 WHERE mssql_rn > :param_1"
        )

        self.assert_compile(
            stmt2,
            "SELECT anon_1.y FROM (SELECT foo(t.x) AS y, "
            "ROW_NUMBER() OVER (ORDER BY foo(t.x) DESC) AS mssql_rn FROM t) "
            "AS anon_1 WHERE mssql_rn > :param_1"
        )

    def test_limit_zero_offset_using_window(self):
        t = table('t', column('x', Integer), column('y', Integer))

        s = select([t]).where(t.c.x == 5).order_by(t.c.y).limit(0).offset(0)

        # render the LIMIT of zero, but not the OFFSET
        # of zero, so produces TOP 0
        self.assert_compile(
            s,
            "SELECT TOP 0 t.x, t.y FROM t "
            "WHERE t.x = :x_1 ORDER BY t.y",
            checkparams={'x_1': 5}
        )

    def test_primary_key_no_identity(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, autoincrement=False,
                           primary_key=True))
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (id INTEGER NOT NULL, "
            "PRIMARY KEY (id))"
        )

    def test_primary_key_defaults_to_identity(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, primary_key=True))
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (id INTEGER NOT NULL IDENTITY(1,1), "
            "PRIMARY KEY (id))"
        )

    def test_identity_no_primary_key(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, autoincrement=True))
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (id INTEGER NOT NULL IDENTITY(1,1)"
            ")"
        )

    def test_identity_separate_from_primary_key(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, autoincrement=False,
                           primary_key=True),
                    Column('x', Integer, autoincrement=True)
                    )
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (id INTEGER NOT NULL, "
            "x INTEGER NOT NULL IDENTITY(1,1), "
            "PRIMARY KEY (id))"
        )

    def test_identity_illegal_two_autoincrements(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, autoincrement=True),
                    Column('id2', Integer, autoincrement=True),
                    )
        # this will be rejected by the database, just asserting this is what
        # the two autoincrements will do right now
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (id INTEGER NOT NULL IDENTITY(1,1), "
            "id2 INTEGER NOT NULL IDENTITY(1,1))"
        )

    def test_identity_start_0(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, mssql_identity_start=0,
                           primary_key=True))
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (id INTEGER NOT NULL IDENTITY(0,1), "
            "PRIMARY KEY (id))"
        )

    def test_identity_increment_5(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, mssql_identity_increment=5,
                           primary_key=True))
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (id INTEGER NOT NULL IDENTITY(1,5), "
            "PRIMARY KEY (id))"
        )

    def test_sequence_start_0(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, Sequence('', 0), primary_key=True))
        with testing.expect_deprecated(
                "Use of Sequence with SQL Server in order to affect "):
            self.assert_compile(
                schema.CreateTable(tbl),
                "CREATE TABLE test (id INTEGER NOT NULL IDENTITY(0,1), "
                "PRIMARY KEY (id))"
            )

    def test_sequence_non_primary_key(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, Sequence('', start=5),
                           primary_key=False))
        with testing.expect_deprecated(
                "Use of Sequence with SQL Server in order to affect "):
            self.assert_compile(
                schema.CreateTable(tbl),
                "CREATE TABLE test (id INTEGER NOT NULL IDENTITY(5,1))"
            )

    def test_sequence_ignore_nullability(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer, Sequence('', start=5),
                           nullable=True))
        with testing.expect_deprecated(
                "Use of Sequence with SQL Server in order to affect "):
            self.assert_compile(
                schema.CreateTable(tbl),
                "CREATE TABLE test (id INTEGER NOT NULL IDENTITY(5,1))"
            )

    def test_table_pkc_clustering(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('x', Integer, autoincrement=False),
                    Column('y', Integer, autoincrement=False),
                    PrimaryKeyConstraint("x", "y", mssql_clustered=True))
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (x INTEGER NOT NULL, y INTEGER NOT NULL, "
            "PRIMARY KEY CLUSTERED (x, y))"
        )

    def test_table_pkc_explicit_nonclustered(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('x', Integer, autoincrement=False),
                    Column('y', Integer, autoincrement=False),
                    PrimaryKeyConstraint("x", "y", mssql_clustered=False))
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (x INTEGER NOT NULL, y INTEGER NOT NULL, "
            "PRIMARY KEY NONCLUSTERED (x, y))"
        )

    def test_table_idx_explicit_nonclustered(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('x', Integer, autoincrement=False),
            Column('y', Integer, autoincrement=False)
        )

        idx = Index("myidx", tbl.c.x, tbl.c.y, mssql_clustered=False)
        self.assert_compile(
            schema.CreateIndex(idx),
            "CREATE NONCLUSTERED INDEX myidx ON test (x, y)"
        )

    def test_table_uc_explicit_nonclustered(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('x', Integer, autoincrement=False),
                    Column('y', Integer, autoincrement=False),
                    UniqueConstraint("x", "y", mssql_clustered=False))
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (x INTEGER NULL, y INTEGER NULL, "
            "UNIQUE NONCLUSTERED (x, y))"
        )

    def test_table_uc_clustering(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('x', Integer, autoincrement=False),
                    Column('y', Integer, autoincrement=False),
                    PrimaryKeyConstraint("x"),
                    UniqueConstraint("y", mssql_clustered=True))
        self.assert_compile(
            schema.CreateTable(tbl),
            "CREATE TABLE test (x INTEGER NOT NULL, y INTEGER NULL, "
            "PRIMARY KEY (x), UNIQUE CLUSTERED (y))"
        )

    def test_index_clustering(self):
        metadata = MetaData()
        tbl = Table('test', metadata,
                    Column('id', Integer))
        idx = Index("foo", tbl.c.id, mssql_clustered=True)
        self.assert_compile(schema.CreateIndex(idx),
                            "CREATE CLUSTERED INDEX foo ON test (id)"
                            )

    def test_index_ordering(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('x', Integer), Column('y', Integer), Column('z', Integer))
        idx = Index("foo", tbl.c.x.desc(), "y")
        self.assert_compile(schema.CreateIndex(idx),
                            "CREATE INDEX foo ON test (x DESC, y)"
                            )

    def test_create_index_expr(self):
        m = MetaData()
        t1 = Table('foo', m,
                   Column('x', Integer)
                   )
        self.assert_compile(
            schema.CreateIndex(Index("bar", t1.c.x > 5)),
            "CREATE INDEX bar ON foo (x > 5)"
        )

    def test_drop_index_w_schema(self):
        m = MetaData()
        t1 = Table('foo', m,
                   Column('x', Integer),
                   schema='bar'
                   )
        self.assert_compile(
            schema.DropIndex(Index("idx_foo", t1.c.x)),
            "DROP INDEX idx_foo ON bar.foo"
        )

    def test_index_extra_include_1(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('x', Integer), Column('y', Integer), Column('z', Integer))
        idx = Index("foo", tbl.c.x, mssql_include=['y'])
        self.assert_compile(schema.CreateIndex(idx),
                            "CREATE INDEX foo ON test (x) INCLUDE (y)"
                            )

    def test_index_extra_include_2(self):
        metadata = MetaData()
        tbl = Table(
            'test', metadata,
            Column('x', Integer), Column('y', Integer), Column('z', Integer))
        idx = Index("foo", tbl.c.x, mssql_include=[tbl.c.y])
        self.assert_compile(schema.CreateIndex(idx),
                            "CREATE INDEX foo ON test (x) INCLUDE (y)"
                            )


class SchemaTest(fixtures.TestBase):

    def setup(self):
        t = Table('sometable', MetaData(),
                  Column('pk_column', Integer),
                  Column('test_column', String)
                  )
        self.column = t.c.test_column

        dialect = mssql.dialect()
        self.ddl_compiler = dialect.ddl_compiler(dialect,
                                                 schema.CreateTable(t))

    def _column_spec(self):
        return self.ddl_compiler.get_column_specification(self.column)

    def test_that_mssql_default_nullability_emits_null(self):
        eq_("test_column VARCHAR(max) NULL", self._column_spec())

    def test_that_mssql_none_nullability_does_not_emit_nullability(self):
        self.column.nullable = None
        eq_("test_column VARCHAR(max)", self._column_spec())

    def test_that_mssql_specified_nullable_emits_null(self):
        self.column.nullable = True
        eq_("test_column VARCHAR(max) NULL", self._column_spec())

    def test_that_mssql_specified_not_nullable_emits_not_null(self):
        self.column.nullable = False
        eq_("test_column VARCHAR(max) NOT NULL", self._column_spec())

[((17, 18, 17, 33), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ({}, {}), '()', False, 'from sqlalchemy.dialects import mssql\n'), ((40, 12, 40, 22), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((49, 12, 49, 22), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((189, 15, 189, 25), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((238, 25, 238, 41), 'sqlalchemy.dialects.mssql.mxodbc.dialect', 'mxodbc.dialect', ({}, {}), '()', False, 'from sqlalchemy.dialects.mssql import mxodbc\n'), ((306, 19, 306, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((318, 19, 318, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((330, 19, 330, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((342, 19, 342, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((354, 19, 354, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((366, 19, 366, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((378, 18, 378, 33), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ({}, {}), '()', False, 'from sqlalchemy.dialects import mssql\n'), ((393, 19, 393, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((406, 19, 406, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((423, 19, 423, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((441, 19, 441, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((471, 12, 471, 52), 'sqlalchemy.union', 'union', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((490, 12, 490, 22), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((696, 12, 696, 22), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((735, 19, 735, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((746, 19, 746, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((756, 19, 756, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((766, 19, 766, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((780, 19, 780, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((794, 19, 794, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((805, 19, 805, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((816, 19, 816, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((828, 19, 828, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((840, 19, 840, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((852, 19, 852, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((864, 19, 864, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((876, 19, 876, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((883, 14, 883, 69), 'sqlalchemy.Index', 'Index', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((890, 19, 890, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((902, 19, 902, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((915, 19, 915, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((918, 14, 918, 58), 'sqlalchemy.Index', 'Index', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((924, 19, 924, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((934, 12, 934, 22), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((944, 12, 944, 22), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((955, 19, 955, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((959, 14, 959, 56), 'sqlalchemy.Index', 'Index', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((965, 19, 965, 29), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((969, 14, 969, 60), 'sqlalchemy.Index', 'Index', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((984, 18, 984, 33), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ({}, {}), '()', False, 'from sqlalchemy.dialects import mssql\n'), ((21, 12, 21, 23), 'sqlalchemy.sql.false', 'sql.false', ({}, {}), '()', False, 'from sqlalchemy import sql\n'), ((24, 12, 24, 22), 'sqlalchemy.sql.true', 'sql.true', ({}, {}), '()', False, 'from sqlalchemy import sql\n'), ((29, 31, 29, 51), 'sqlalchemy.sql.column', 'column', ({(29, 38, 29, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((34, 31, 34, 51), 'sqlalchemy.sql.column', 'column', ({(34, 38, 34, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((41, 34, 41, 63), 'sqlalchemy.Column', 'Column', ({(41, 41, 41, 53): '"""somecolumn"""', (41, 55, 41, 62): 'Integer'}, {}), "('somecolumn', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((50, 34, 50, 62), 'sqlalchemy.Column', 'Column', ({(50, 41, 50, 53): '"""somecolumn"""', (50, 55, 50, 61): 'String'}, {}), "('somecolumn', String)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((64, 19, 64, 39), 'sqlalchemy.sql.column', 'column', ({(64, 26, 64, 29): '"""a"""', (64, 31, 64, 38): 'Integer'}, {}), "('a', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((65, 19, 65, 38), 'sqlalchemy.sql.column', 'column', ({(65, 26, 65, 29): '"""b"""', (65, 31, 65, 37): 'String'}, {}), "('b', String)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((66, 19, 66, 38), 'sqlalchemy.sql.column', 'column', ({(66, 26, 66, 29): '"""c"""', (66, 31, 66, 37): 'String'}, {}), "('c', String)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((69, 19, 69, 39), 'sqlalchemy.sql.column', 'column', ({(69, 26, 69, 29): '"""a"""', (69, 31, 69, 38): 'Integer'}, {}), "('a', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((70, 19, 70, 39), 'sqlalchemy.sql.column', 'column', ({(70, 26, 70, 29): '"""b"""', (70, 31, 70, 38): 'Integer'}, {}), "('b', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((71, 19, 71, 39), 'sqlalchemy.sql.column', 'column', ({(71, 26, 71, 29): '"""c"""', (71, 31, 71, 38): 'Integer'}, {}), "('c', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((82, 31, 82, 51), 'sqlalchemy.sql.column', 'column', ({(82, 38, 82, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((88, 31, 88, 51), 'sqlalchemy.sql.column', 'column', ({(88, 38, 88, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((95, 31, 95, 51), 'sqlalchemy.sql.column', 'column', ({(95, 38, 95, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((109, 31, 109, 51), 'sqlalchemy.sql.column', 'column', ({(109, 38, 109, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((124, 31, 124, 51), 'sqlalchemy.sql.column', 'column', ({(124, 38, 124, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((134, 31, 134, 51), 'sqlalchemy.sql.column', 'column', ({(134, 38, 134, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((147, 31, 147, 51), 'sqlalchemy.sql.column', 'column', ({(147, 38, 147, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((157, 25, 157, 37), 'sqlalchemy.sql.column', 'column', ({(157, 32, 157, 36): '"""c1"""'}, {}), "('c1')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((158, 25, 158, 37), 'sqlalchemy.sql.column', 'column', ({(158, 32, 158, 36): '"""c1"""'}, {}), "('c1')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((166, 25, 166, 37), 'sqlalchemy.sql.column', 'column', ({(166, 32, 166, 36): '"""c1"""'}, {}), "('c1')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((171, 28, 171, 42), 'sqlalchemy.sql.delete', 'sql.delete', ({(171, 39, 171, 41): 'a1'}, {}), '(a1)', False, 'from sqlalchemy import sql\n'), ((174, 31, 174, 51), 'sqlalchemy.sql.column', 'column', ({(174, 38, 174, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((175, 33, 175, 53), 'sqlalchemy.sql.column', 'column', ({(175, 40, 175, 52): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((192, 12, 192, 33), 'sqlalchemy.Column', 'Column', ({(192, 19, 192, 24): '"""sym"""', (192, 26, 192, 32): 'String'}, {}), "('sym', String)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((193, 12, 193, 34), 'sqlalchemy.Column', 'Column', ({(193, 19, 193, 24): '"""val"""', (193, 26, 193, 33): 'Integer'}, {}), "('val', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((198, 12, 198, 33), 'sqlalchemy.Column', 'Column', ({(198, 19, 198, 24): '"""sym"""', (198, 26, 198, 32): 'String'}, {}), "('sym', String)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((199, 12, 199, 37), 'sqlalchemy.Column', 'Column', ({(199, 19, 199, 27): '"""newval"""', (199, 29, 199, 36): 'Integer'}, {}), "('newval', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((241, 31, 241, 44), 'sqlalchemy.sql.column', 'column', ({(241, 38, 241, 43): '"""foo"""'}, {}), "('foo')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((266, 31, 266, 51), 'sqlalchemy.sql.column', 'column', ({(266, 38, 266, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((282, 31, 282, 51), 'sqlalchemy.sql.column', 'column', ({(282, 38, 282, 50): '"""somecolumn"""'}, {}), "('somecolumn')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((292, 23, 292, 46), 'sqlalchemy.sql.column', 'column', ({(292, 30, 292, 36): '"""myid"""', (292, 38, 292, 45): 'Integer'}, {}), "('myid', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((293, 23, 293, 45), 'sqlalchemy.sql.column', 'column', ({(293, 30, 293, 36): '"""name"""', (293, 38, 293, 44): 'String'}, {}), "('name', String)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((294, 23, 294, 52), 'sqlalchemy.sql.column', 'column', ({(294, 30, 294, 43): '"""description"""', (294, 45, 294, 51): 'String'}, {}), "('description', String)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((300, 28, 300, 47), 'sqlalchemy.select', 'select', ({(300, 35, 300, 40): "['*']", (300, 42, 300, 46): 'crit'}, {}), "(['*'], crit)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((309, 12, 309, 51), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((313, 12, 313, 25), 'sqlalchemy.select', 'select', ({(313, 19, 313, 24): '[tbl]'}, {}), '([tbl])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((321, 12, 321, 51), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((325, 12, 325, 25), 'sqlalchemy.select', 'select', ({(325, 19, 325, 24): '[tbl]'}, {}), '([tbl])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((333, 12, 333, 51), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((337, 12, 337, 25), 'sqlalchemy.select', 'select', ({(337, 19, 337, 24): '[tbl]'}, {}), '([tbl])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((345, 12, 345, 51), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((349, 12, 349, 25), 'sqlalchemy.select', 'select', ({(349, 19, 349, 24): '[tbl]'}, {}), '([tbl])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((357, 12, 357, 51), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((361, 12, 361, 25), 'sqlalchemy.select', 'select', ({(361, 19, 361, 24): '[tbl]'}, {}), '([tbl])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((369, 12, 369, 51), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((373, 12, 373, 25), 'sqlalchemy.select', 'select', ({(373, 19, 373, 24): '[tbl]'}, {}), '([tbl])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((387, 28, 387, 68), 'sqlalchemy.dialects.mssql.base._owner_plus_db', 'base._owner_plus_db', ({(387, 48, 387, 55): 'dialect', (387, 57, 387, 67): 'identifier'}, {}), '(dialect, identifier)', False, 'from sqlalchemy.dialects.mssql import base\n'), ((389, 12, 389, 38), 'sqlalchemy.testing.eq_', 'eq_', ({(389, 16, 389, 21): 'owner', (389, 23, 389, 37): 'expected_owner'}, {}), '(owner, expected_owner)', False, 'from sqlalchemy.testing import eq_, is_\n'), ((390, 12, 390, 40), 'sqlalchemy.testing.eq_', 'eq_', ({(390, 16, 390, 22): 'schema', (390, 24, 390, 39): 'expected_schema'}, {}), '(schema, expected_schema)', False, 'from sqlalchemy.testing import eq_, is_\n'), ((394, 38, 395, 62), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((409, 12, 410, 36), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((426, 12, 426, 51), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((442, 38, 443, 62), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((461, 18, 461, 32), 'sqlalchemy.sql.column', 'column', ({(461, 25, 461, 31): '"""col1"""'}, {}), "('col1')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((461, 34, 461, 48), 'sqlalchemy.sql.column', 'column', ({(461, 41, 461, 47): '"""col2"""'}, {}), "('col2')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((462, 12, 462, 26), 'sqlalchemy.sql.column', 'column', ({(462, 19, 462, 25): '"""col3"""'}, {}), "('col3')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((462, 28, 462, 42), 'sqlalchemy.sql.column', 'column', ({(462, 35, 462, 41): '"""col4"""'}, {}), "('col4')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((464, 18, 464, 32), 'sqlalchemy.sql.column', 'column', ({(464, 25, 464, 31): '"""col1"""'}, {}), "('col1')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((464, 34, 464, 48), 'sqlalchemy.sql.column', 'column', ({(464, 41, 464, 47): '"""col2"""'}, {}), "('col2')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((465, 12, 465, 26), 'sqlalchemy.sql.column', 'column', ({(465, 19, 465, 25): '"""col3"""'}, {}), "('col3')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((465, 28, 465, 42), 'sqlalchemy.sql.column', 'column', ({(465, 35, 465, 41): '"""col4"""'}, {}), "('col4')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((487, 28, 487, 42), 'sqlalchemy.func.foo', 'func.foo', ({(487, 37, 487, 38): '(1)', (487, 40, 487, 41): '(2)'}, {}), '(1, 2)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((488, 28, 488, 47), 'sqlalchemy.func.current_time', 'func.current_time', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((489, 28, 489, 38), 'sqlalchemy.func.foo', 'func.foo', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((492, 28, 492, 51), 'sqlalchemy.Column', 'Column', ({(492, 35, 492, 41): '"""col1"""', (492, 43, 492, 50): 'Integer'}, {}), "('col1', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((492, 53, 492, 76), 'sqlalchemy.Column', 'Column', ({(492, 60, 492, 66): '"""col2"""', (492, 68, 492, 75): 'Integer'}, {}), "('col2', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((498, 28, 498, 47), 'sqlalchemy.func.current_date', 'func.current_date', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((499, 28, 499, 42), 'sqlalchemy.func.length', 'func.length', ({(499, 40, 499, 41): '(3)'}, {}), '(3)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((502, 23, 502, 37), 'sqlalchemy.sql.column', 'column', ({(502, 30, 502, 36): '"""col1"""'}, {}), "('col1')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((512, 12, 512, 35), 'sqlalchemy.sql.column', 'column', ({(512, 19, 512, 25): '"""myid"""', (512, 27, 512, 34): 'Integer'}, {}), "('myid', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((536, 52, 536, 78), 'sqlalchemy.func.length', 'func.length', ({(536, 64, 536, 77): 'table1.c.name'}, {}), '(table1.c.name)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((543, 23, 543, 46), 'sqlalchemy.sql.column', 'column', ({(543, 30, 543, 36): '"""myid"""', (543, 38, 543, 45): 'Integer'}, {}), "('myid', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((558, 23, 558, 46), 'sqlalchemy.sql.column', 'column', ({(558, 30, 558, 36): '"""myid"""', (558, 38, 558, 45): 'Integer'}, {}), "('myid', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((573, 52, 573, 78), 'sqlalchemy.func.length', 'func.length', ({(573, 64, 573, 77): 'table1.c.name'}, {}), '(table1.c.name)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((580, 23, 580, 43), 'sqlalchemy.sql.column', 'column', ({(580, 30, 580, 33): '"""x"""', (580, 35, 580, 42): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((580, 45, 580, 65), 'sqlalchemy.sql.column', 'column', ({(580, 52, 580, 55): '"""y"""', (580, 57, 580, 64): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((591, 23, 591, 43), 'sqlalchemy.sql.column', 'column', ({(591, 30, 591, 33): '"""x"""', (591, 35, 591, 42): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((591, 45, 591, 65), 'sqlalchemy.sql.column', 'column', ({(591, 52, 591, 55): '"""y"""', (591, 57, 591, 64): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((605, 23, 605, 43), 'sqlalchemy.sql.column', 'column', ({(605, 30, 605, 33): '"""x"""', (605, 35, 605, 42): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((605, 45, 605, 65), 'sqlalchemy.sql.column', 'column', ({(605, 52, 605, 55): '"""y"""', (605, 57, 605, 64): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((626, 23, 626, 43), 'sqlalchemy.sql.column', 'column', ({(626, 30, 626, 33): '"""x"""', (626, 35, 626, 42): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((626, 45, 626, 65), 'sqlalchemy.sql.column', 'column', ({(626, 52, 626, 55): '"""y"""', (626, 57, 626, 64): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((646, 23, 646, 43), 'sqlalchemy.sql.column', 'column', ({(646, 30, 646, 33): '"""x"""', (646, 35, 646, 42): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((646, 45, 646, 65), 'sqlalchemy.sql.column', 'column', ({(646, 52, 646, 55): '"""y"""', (646, 57, 646, 64): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((667, 12, 667, 47), 'sqlalchemy.testing.is_', 'is_', ({(667, 16, 667, 41): 'result_map[col.key][1][0]', (667, 43, 667, 46): 'col'}, {}), '(result_map[col.key][1][0], col)', False, 'from sqlalchemy.testing import eq_, is_\n'), ((670, 25, 670, 45), 'sqlalchemy.sql.column', 'column', ({(670, 32, 670, 35): '"""x"""', (670, 37, 670, 44): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((670, 47, 670, 67), 'sqlalchemy.sql.column', 'column', ({(670, 54, 670, 57): '"""y"""', (670, 59, 670, 66): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((671, 25, 671, 45), 'sqlalchemy.sql.column', 'column', ({(671, 32, 671, 35): '"""x"""', (671, 37, 671, 44): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((671, 47, 671, 67), 'sqlalchemy.sql.column', 'column', ({(671, 54, 671, 57): '"""y"""', (671, 59, 671, 66): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((698, 26, 698, 46), 'sqlalchemy.Column', 'Column', ({(698, 33, 698, 36): '"""x"""', (698, 38, 698, 45): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((721, 23, 721, 43), 'sqlalchemy.sql.column', 'column', ({(721, 30, 721, 33): '"""x"""', (721, 35, 721, 42): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((721, 45, 721, 65), 'sqlalchemy.sql.column', 'column', ({(721, 52, 721, 55): '"""y"""', (721, 57, 721, 64): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((737, 20, 738, 44), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((740, 12, 740, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(740, 31, 740, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((748, 20, 748, 59), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((750, 12, 750, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(750, 31, 750, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((758, 20, 758, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((760, 12, 760, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(760, 31, 760, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((768, 20, 769, 44), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((770, 20, 770, 60), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((773, 12, 773, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(773, 31, 773, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((782, 20, 782, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((783, 20, 783, 62), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((788, 12, 788, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(788, 31, 788, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((796, 20, 797, 44), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((799, 12, 799, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(799, 31, 799, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((807, 20, 808, 44), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((810, 12, 810, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(810, 31, 810, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((819, 13, 820, 70), 'sqlalchemy.testing.expect_deprecated', 'testing.expect_deprecated', ({(820, 16, 820, 69): '"""Use of Sequence with SQL Server in order to affect """'}, {}), "('Use of Sequence with SQL Server in order to affect '\n    )", False, 'from sqlalchemy import testing\n'), ((832, 13, 833, 70), 'sqlalchemy.testing.expect_deprecated', 'testing.expect_deprecated', ({(833, 16, 833, 69): '"""Use of Sequence with SQL Server in order to affect """'}, {}), "('Use of Sequence with SQL Server in order to affect '\n    )", False, 'from sqlalchemy import testing\n'), ((844, 13, 845, 70), 'sqlalchemy.testing.expect_deprecated', 'testing.expect_deprecated', ({(845, 16, 845, 69): '"""Use of Sequence with SQL Server in order to affect """'}, {}), "('Use of Sequence with SQL Server in order to affect '\n    )", False, 'from sqlalchemy import testing\n'), ((854, 20, 854, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((855, 20, 855, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((856, 20, 856, 72), 'sqlalchemy.PrimaryKeyConstraint', 'PrimaryKeyConstraint', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((858, 12, 858, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(858, 31, 858, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((866, 20, 866, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((867, 20, 867, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((868, 20, 868, 73), 'sqlalchemy.PrimaryKeyConstraint', 'PrimaryKeyConstraint', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((870, 12, 870, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(870, 31, 870, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((879, 12, 879, 53), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((880, 12, 880, 53), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((885, 12, 885, 35), 'sqlalchemy.schema.CreateIndex', 'schema.CreateIndex', ({(885, 31, 885, 34): 'idx'}, {}), '(idx)', False, 'from sqlalchemy import schema\n'), ((892, 20, 892, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((893, 20, 893, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((894, 20, 894, 69), 'sqlalchemy.UniqueConstraint', 'UniqueConstraint', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((896, 12, 896, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(896, 31, 896, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((904, 20, 904, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((905, 20, 905, 61), 'sqlalchemy.Column', 'Column', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((906, 20, 906, 45), 'sqlalchemy.PrimaryKeyConstraint', 'PrimaryKeyConstraint', ({(906, 41, 906, 44): '"""x"""'}, {}), "('x')", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((907, 20, 907, 63), 'sqlalchemy.UniqueConstraint', 'UniqueConstraint', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((909, 12, 909, 35), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(909, 31, 909, 34): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((917, 20, 917, 41), 'sqlalchemy.Column', 'Column', ({(917, 27, 917, 31): '"""id"""', (917, 33, 917, 40): 'Integer'}, {}), "('id', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((919, 28, 919, 51), 'sqlalchemy.schema.CreateIndex', 'schema.CreateIndex', ({(919, 47, 919, 50): 'idx'}, {}), '(idx)', False, 'from sqlalchemy import schema\n'), ((927, 12, 927, 32), 'sqlalchemy.Column', 'Column', ({(927, 19, 927, 22): '"""x"""', (927, 24, 927, 31): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((927, 34, 927, 54), 'sqlalchemy.Column', 'Column', ({(927, 41, 927, 44): '"""y"""', (927, 46, 927, 53): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((927, 56, 927, 76), 'sqlalchemy.Column', 'Column', ({(927, 63, 927, 66): '"""z"""', (927, 68, 927, 75): 'Integer'}, {}), "('z', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((929, 28, 929, 51), 'sqlalchemy.schema.CreateIndex', 'schema.CreateIndex', ({(929, 47, 929, 50): 'idx'}, {}), '(idx)', False, 'from sqlalchemy import schema\n'), ((936, 19, 936, 39), 'sqlalchemy.Column', 'Column', ({(936, 26, 936, 29): '"""x"""', (936, 31, 936, 38): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((946, 19, 946, 39), 'sqlalchemy.Column', 'Column', ({(946, 26, 946, 29): '"""x"""', (946, 31, 946, 38): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((958, 12, 958, 32), 'sqlalchemy.Column', 'Column', ({(958, 19, 958, 22): '"""x"""', (958, 24, 958, 31): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((958, 34, 958, 54), 'sqlalchemy.Column', 'Column', ({(958, 41, 958, 44): '"""y"""', (958, 46, 958, 53): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((958, 56, 958, 76), 'sqlalchemy.Column', 'Column', ({(958, 63, 958, 66): '"""z"""', (958, 68, 958, 75): 'Integer'}, {}), "('z', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((960, 28, 960, 51), 'sqlalchemy.schema.CreateIndex', 'schema.CreateIndex', ({(960, 47, 960, 50): 'idx'}, {}), '(idx)', False, 'from sqlalchemy import schema\n'), ((968, 12, 968, 32), 'sqlalchemy.Column', 'Column', ({(968, 19, 968, 22): '"""x"""', (968, 24, 968, 31): 'Integer'}, {}), "('x', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((968, 34, 968, 54), 'sqlalchemy.Column', 'Column', ({(968, 41, 968, 44): '"""y"""', (968, 46, 968, 53): 'Integer'}, {}), "('y', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((968, 56, 968, 76), 'sqlalchemy.Column', 'Column', ({(968, 63, 968, 66): '"""z"""', (968, 68, 968, 75): 'Integer'}, {}), "('z', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((970, 28, 970, 51), 'sqlalchemy.schema.CreateIndex', 'schema.CreateIndex', ({(970, 47, 970, 50): 'idx'}, {}), '(idx)', False, 'from sqlalchemy import schema\n'), ((978, 31, 978, 41), 'sqlalchemy.MetaData', 'MetaData', ({}, {}), '()', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((979, 18, 979, 46), 'sqlalchemy.Column', 'Column', ({(979, 25, 979, 36): '"""pk_column"""', (979, 38, 979, 45): 'Integer'}, {}), "('pk_column', Integer)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((980, 18, 980, 47), 'sqlalchemy.Column', 'Column', ({(980, 25, 980, 38): '"""test_column"""', (980, 40, 980, 46): 'String'}, {}), "('test_column', String)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((986, 49, 986, 70), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(986, 68, 986, 69): 't'}, {}), '(t)', False, 'from sqlalchemy import schema\n'), ((159, 12, 159, 26), 'sqlalchemy.sql.delete', 'sql.delete', ({(159, 23, 159, 25): 't1'}, {}), '(t1)', False, 'from sqlalchemy import sql\n'), ((167, 12, 167, 26), 'sqlalchemy.sql.delete', 'sql.delete', ({(167, 23, 167, 25): 'a1'}, {}), '(a1)', False, 'from sqlalchemy import sql\n'), ((297, 12, 298, 44), 'sqlalchemy.select', 'select', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((310, 19, 310, 47), 'sqlalchemy.sql.quoted_name', 'quoted_name', ({(310, 31, 310, 40): '"""foo.dbo"""', (310, 42, 310, 46): 'True'}, {}), "('foo.dbo', True)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((322, 19, 322, 47), 'sqlalchemy.sql.quoted_name', 'quoted_name', ({(322, 31, 322, 40): '"""foo.dbo"""', (322, 42, 322, 46): 'True'}, {}), "('foo.dbo', True)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((334, 19, 334, 47), 'sqlalchemy.sql.quoted_name', 'quoted_name', ({(334, 31, 334, 40): '"""Foo.dbo"""', (334, 42, 334, 46): 'True'}, {}), "('Foo.dbo', True)", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((399, 12, 399, 30), 'sqlalchemy.select', 'select', ({(399, 19, 399, 29): '[tbl.c.id]'}, {}), '([tbl.c.id])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((415, 12, 415, 30), 'sqlalchemy.select', 'select', ({(415, 19, 415, 29): '[tbl.c.id]'}, {}), '([tbl.c.id])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((431, 12, 431, 30), 'sqlalchemy.select', 'select', ({(431, 19, 431, 29): '[tbl.c.id]'}, {}), '([tbl.c.id])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((449, 12, 449, 30), 'sqlalchemy.select', 'select', ({(449, 19, 449, 29): '[tbl.c.id]'}, {}), '([tbl.c.id])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((513, 27, 513, 38), 'sqlalchemy.String', 'String', ({(513, 34, 513, 37): '128'}, {}), '(128)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((514, 34, 514, 45), 'sqlalchemy.String', 'String', ({(514, 41, 514, 44): '128'}, {}), '(128)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((544, 27, 544, 38), 'sqlalchemy.String', 'String', ({(544, 34, 544, 37): '128'}, {}), '(128)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((544, 63, 544, 74), 'sqlalchemy.String', 'String', ({(544, 70, 544, 73): '128'}, {}), '(128)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((545, 12, 545, 26), 'sqlalchemy.delete', 'delete', ({(545, 19, 545, 25): 'table1'}, {}), '(table1)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((559, 27, 559, 38), 'sqlalchemy.String', 'String', ({(559, 34, 559, 37): '128'}, {}), '(128)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((559, 63, 559, 74), 'sqlalchemy.String', 'String', ({(559, 70, 559, 73): '128'}, {}), '(128)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((600, 30, 600, 45), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ({}, {}), '()', False, 'from sqlalchemy.dialects import mssql\n'), ((640, 30, 640, 45), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ({}, {}), '()', False, 'from sqlalchemy.dialects import mssql\n'), ((661, 30, 661, 45), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ({}, {}), '()', False, 'from sqlalchemy.dialects import mssql\n'), ((690, 30, 690, 45), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ({}, {}), '()', False, 'from sqlalchemy.dialects import mssql\n'), ((700, 16, 700, 31), 'sqlalchemy.func.foo', 'func.foo', ({(700, 25, 700, 30): 't.c.x'}, {}), '(t.c.x)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((701, 16, 701, 31), 'sqlalchemy.func.foo', 'func.foo', ({(701, 25, 701, 30): 't.c.x'}, {}), '(t.c.x)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((818, 42, 818, 57), 'sqlalchemy.Sequence', 'Sequence', ({(818, 51, 818, 53): '""""""', (818, 55, 818, 56): '0'}, {}), "('', 0)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((822, 16, 822, 39), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(822, 35, 822, 38): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((830, 42, 830, 63), 'sqlalchemy.Sequence', 'Sequence', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((835, 16, 835, 39), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(835, 35, 835, 38): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((842, 42, 842, 63), 'sqlalchemy.Sequence', 'Sequence', (), '', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((847, 16, 847, 39), 'sqlalchemy.schema.CreateTable', 'schema.CreateTable', ({(847, 35, 847, 38): 'tbl'}, {}), '(tbl)', False, 'from sqlalchemy import schema\n'), ((939, 31, 939, 55), 'sqlalchemy.Index', 'Index', ({(939, 37, 939, 42): '"""bar"""', (939, 44, 939, 54): '(t1.c.x > 5)'}, {}), "('bar', t1.c.x > 5)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((950, 29, 950, 53), 'sqlalchemy.Index', 'Index', ({(950, 35, 950, 44): '"""idx_foo"""', (950, 46, 950, 52): 't1.c.x'}, {}), "('idx_foo', t1.c.x)", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((53, 12, 53, 23), 'sqlalchemy.select', 'select', ({(53, 19, 53, 22): '[t]'}, {}), '([t])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((165, 25, 165, 37), 'sqlalchemy.sql.column', 'column', ({(165, 32, 165, 36): '"""c1"""'}, {}), "('c1')", False, 'from sqlalchemy.sql import table, column, quoted_name\n'), ((493, 36, 493, 54), 'sqlalchemy.func.max', 'func.max', ({(493, 45, 493, 53): 't.c.col1'}, {}), '(t.c.col1)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((621, 34, 621, 49), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ({}, {}), '()', False, 'from sqlalchemy.dialects import mssql\n'), ((245, 24, 245, 36), 'sqlalchemy.literal', 'literal', ({(245, 32, 245, 35): '"""x"""'}, {}), "('x')", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((245, 38, 245, 50), 'sqlalchemy.literal', 'literal', ({(245, 46, 245, 49): '"""y"""'}, {}), "('y')", False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((249, 16, 249, 27), 'sqlalchemy.select', 'select', ({(249, 23, 249, 26): '[t]'}, {}), '([t])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((506, 24, 506, 48), 'sqlalchemy.extract', 'extract', ({(506, 32, 506, 37): 'field', (506, 39, 506, 47): 't.c.col1'}, {}), '(field, t.c.col1)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((549, 12, 549, 26), 'sqlalchemy.delete', 'delete', ({(549, 19, 549, 25): 'table1'}, {}), '(table1)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((673, 19, 673, 35), 'sqlalchemy.select', 'select', ({(673, 26, 673, 34): '[t2.c.y]'}, {}), '([t2.c.y])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((703, 16, 703, 31), 'sqlalchemy.select', 'select', ({(703, 23, 703, 30): '[expr1]'}, {}), '([expr1])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((704, 16, 704, 31), 'sqlalchemy.select', 'select', ({(704, 23, 704, 30): '[expr2]'}, {}), '([expr2])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((202, 16, 202, 40), 'sqlalchemy.select', 'select', ({(202, 23, 202, 39): '[other.c.newval]'}, {}), '([other.c.newval])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((582, 12, 582, 23), 'sqlalchemy.select', 'select', ({(582, 19, 582, 22): '[t]'}, {}), '([t])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((593, 12, 593, 23), 'sqlalchemy.select', 'select', ({(593, 19, 593, 22): '[t]'}, {}), '([t])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((607, 12, 607, 23), 'sqlalchemy.select', 'select', ({(607, 19, 607, 22): '[t]'}, {}), '([t])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((628, 12, 628, 23), 'sqlalchemy.select', 'select', ({(628, 19, 628, 22): '[t]'}, {}), '([t])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((649, 12, 649, 24), 'sqlalchemy.select', 'select', ({(649, 19, 649, 23): 'cols'}, {}), '(cols)', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((674, 12, 674, 24), 'sqlalchemy.select', 'select', ({(674, 19, 674, 23): '[t1]'}, {}), '([t1])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n'), ((723, 12, 723, 23), 'sqlalchemy.select', 'select', ({(723, 19, 723, 22): '[t]'}, {}), '([t])', False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, delete, insert, extract, union, func, PrimaryKeyConstraint, UniqueConstraint, Index, Sequence, literal\n')]