(self)
| 3717 | ) |
| 3718 | |
| 3719 | def test_hints(self): |
| 3720 | s = select(table1.c.myid).with_hint(table1, "test hint %(name)s") |
| 3721 | |
| 3722 | s2 = ( |
| 3723 | select(table1.c.myid) |
| 3724 | .with_hint(table1, "index(%(name)s idx)", "oracle") |
| 3725 | .with_hint(table1, "WITH HINT INDEX idx", "mssql") |
| 3726 | ) |
| 3727 | |
| 3728 | a1 = table1.alias() |
| 3729 | s3 = select(a1.c.myid).with_hint(a1, "index(%(name)s hint)") |
| 3730 | |
| 3731 | subs4 = ( |
| 3732 | select(table1, table2) |
| 3733 | .select_from( |
| 3734 | table1.join(table2, table1.c.myid == table2.c.otherid) |
| 3735 | ) |
| 3736 | .with_hint(table1, "hint1") |
| 3737 | ).subquery() |
| 3738 | |
| 3739 | s4 = ( |
| 3740 | select(table3) |
| 3741 | .select_from( |
| 3742 | table3.join(subs4, subs4.c.othername == table3.c.otherstuff) |
| 3743 | ) |
| 3744 | .with_hint(table3, "hint3") |
| 3745 | ) |
| 3746 | |
| 3747 | t1 = table("QuotedName", column("col1")) |
| 3748 | s6 = ( |
| 3749 | select(t1.c.col1) |
| 3750 | .where(t1.c.col1 > 10) |
| 3751 | .with_hint(t1, "%(name)s idx1") |
| 3752 | ) |
| 3753 | a2 = t1.alias("SomeName") |
| 3754 | s7 = ( |
| 3755 | select(a2.c.col1) |
| 3756 | .where(a2.c.col1 > 10) |
| 3757 | .with_hint(a2, "%(name)s idx1") |
| 3758 | ) |
| 3759 | |
| 3760 | mysql_d, oracle_d, mssql_d = ( |
| 3761 | mysql.dialect(), |
| 3762 | oracle.dialect(), |
| 3763 | mssql.dialect(), |
| 3764 | ) |
| 3765 | |
| 3766 | for stmt, dialect, expected in [ |
| 3767 | (s, mysql_d, "SELECT mytable.myid FROM mytable test hint mytable"), |
| 3768 | ( |
| 3769 | s, |
| 3770 | oracle_d, |
| 3771 | "SELECT /*+ test hint mytable */ mytable.myid FROM mytable", |
| 3772 | ), |
| 3773 | ( |
| 3774 | s, |
| 3775 | mssql_d, |
| 3776 | "SELECT mytable.myid FROM mytable test hint mytable", |
nothing calls this directly
no test coverage detected