(self)
| 1942 | ) |
| 1943 | |
| 1944 | def test_distinct(self): |
| 1945 | self.assert_compile( |
| 1946 | select(table1.c.myid.distinct()), |
| 1947 | "SELECT DISTINCT mytable.myid FROM mytable", |
| 1948 | ) |
| 1949 | |
| 1950 | self.assert_compile( |
| 1951 | select(distinct(table1.c.myid)), |
| 1952 | "SELECT DISTINCT mytable.myid FROM mytable", |
| 1953 | ) |
| 1954 | |
| 1955 | self.assert_compile( |
| 1956 | select(distinct(table1.c.myid)).set_label_style( |
| 1957 | LABEL_STYLE_TABLENAME_PLUS_COL |
| 1958 | ), |
| 1959 | "SELECT DISTINCT mytable.myid FROM mytable", |
| 1960 | ) |
| 1961 | |
| 1962 | # the bug fixed here as part of #6008 is the same bug that's |
| 1963 | # in 1.3 as well, producing |
| 1964 | # "SELECT anon_2.anon_1 FROM (SELECT distinct mytable.myid |
| 1965 | # FROM mytable) AS anon_2" |
| 1966 | self.assert_compile( |
| 1967 | select(select(distinct(table1.c.myid)).subquery()), |
| 1968 | "SELECT anon_2.anon_1 FROM (SELECT " |
| 1969 | "DISTINCT mytable.myid AS anon_1 FROM mytable) AS anon_2", |
| 1970 | ) |
| 1971 | |
| 1972 | self.assert_compile( |
| 1973 | select(table1.c.myid).distinct(), |
| 1974 | "SELECT DISTINCT mytable.myid FROM mytable", |
| 1975 | ) |
| 1976 | |
| 1977 | self.assert_compile( |
| 1978 | select(func.count(table1.c.myid.distinct())), |
| 1979 | "SELECT count(DISTINCT mytable.myid) AS count_1 FROM mytable", |
| 1980 | ) |
| 1981 | |
| 1982 | self.assert_compile( |
| 1983 | select(func.count(distinct(table1.c.myid))), |
| 1984 | "SELECT count(DISTINCT mytable.myid) AS count_1 FROM mytable", |
| 1985 | ) |
| 1986 | |
| 1987 | @testing.variation("case", ["stringify", "final_froms"]) |
| 1988 | def test_distinct_expr_no_dep_warning_str_compiler(self, case): |
nothing calls this directly
no test coverage detected