Пример #1
0
 def test_vertica_query_uses_double_quote_chars(self):
     q = VerticaQuery.from_(self.table_abc).select(
         self.table_abc.foo
     ).groupby(
         self.table_abc.foo
     ).having(
         self.table_abc.buz == 'fiz'
     )
     self.assertEqual("SELECT \"foo\" FROM \"abc\" GROUP BY \"foo\" HAVING \"buz\"='fiz'", str(q))
Пример #2
0
    def test_vertica_query_uses_double_quote_chars(self):
        q = VerticaQuery.from_('abc').select('foo', 'bar')

        self.assertEqual('SELECT "foo","bar" FROM "abc"', str(q))
Пример #3
0
    def test_vertica_query_uses_double_quote_chars(self):
        q = VerticaQuery.from_(self.t).groupby(self.t.foo).select(self.t.foo)

        self.assertEqual('SELECT "foo" FROM "abc" GROUP BY "foo"', str(q))
Пример #4
0
 def test_add_hint_to_query_if_supported_by_dialect_and_hint_is_set(self):
     query = VerticaQuery.from_('table').select('*')
     query_hint = add_hints([query], 'test_hint')
     self.assertEqual('SELECT /*+label(test_hint)*/ * FROM "table"', str(query_hint[0]))
Пример #5
0
 def test_do_not_add_hints_to_query_if_no_hint_string_supplied(self):
     query = VerticaQuery.from_('table').select('*')
     query_hint = add_hints([query], hint=None)
     self.assertEqual('SELECT * FROM "table"', str(query_hint[0]))
Пример #6
0
    def test_vertica_query_uses_double_quote_chars(self):
        q = VerticaQuery.from_("abc").select("foo", "bar")

        self.assertEqual('SELECT "foo","bar" FROM "abc"', str(q))
Пример #7
0
    def test_vertica_query_uses_double_quote_chars(self):
        q = VerticaQuery.from_(self.t).groupby(self.t.foo).select(self.t.foo)

        self.assertEqual('SELECT "foo" FROM "abc" GROUP BY "foo"', str(q))
Пример #8
0
    def test__split_part(self):
        q = VerticaQuery.from_(self.t).select(fn.SplitPart(self.t.foo, "|", 3))

        self.assertEqual('SELECT SPLIT_PART("foo",\'|\',3) FROM "abc"', str(q))
Пример #9
0
    def test__regexp_like(self):
        q = VerticaQuery.from_(self.t).select(
            fn.RegexpLike(self.t.foo, "^a", "x"))

        self.assertEqual("SELECT REGEXP_LIKE(\"foo\",'^a','x') FROM \"abc\"",
                         str(q))
Пример #10
0
    def test__split_part(self):
        q = VerticaQuery.from_(self.t).select(fn.SplitPart(self.t.foo, '|', 3))

        self.assertEqual("SELECT SPLIT_PART(\"foo\",\'|\',3) FROM \"abc\"", str(q))
Пример #11
0
    def test__regexp_like(self):
        q = VerticaQuery.from_(self.t).select(fn.RegexpLike(self.t.foo, '^a', 'x'))

        self.assertEqual("SELECT REGEXP_LIKE(\"foo\",\'^a\',\'x\') FROM \"abc\"", str(q))
Пример #12
0
    def test__split_part(self):
        q = VerticaQuery.from_(self.t).select(fn.SplitPart(self.t.foo, '|', 3))

        self.assertEqual("SELECT SPLIT_PART(\"foo\",\'|\',3) FROM \"abc\"", str(q))
Пример #13
0
 def test_do_not_add_hints_to_query_if_no_hint_string_supplied(self):
     query = VerticaQuery.from_('table').select('*')
     query_hint = add_hints([query], hint=None)
     self.assertEqual('SELECT * FROM "table"', str(query_hint[0]))
Пример #14
0
 def test_add_hint_to_query_if_supported_by_dialect_and_hint_is_set(self):
     query = VerticaQuery.from_('table').select('*')
     query_hint = add_hints([query], 'test_hint')
     self.assertEqual('SELECT /*+label(test_hint)*/ * FROM "table"',
                      str(query_hint[0]))