chore: ci Initial hive support (#10593)

* Initial hive support

* Clone hive setup

* Make hive tests work locally

* Debugging presto failure

* sleep in dataset test

* Address comments

* Address comments

* Pin ipython, exclude new pylint rules

Co-authored-by: bogdan kyryliuk <bogdankyryliuk@dropbox.com>
This commit is contained in:
Bogdan
2020-08-27 09:49:18 -07:00
committed by GitHub
co-authored by bogdan kyryliuk
parent 81525c3e9d
commit 19a9bcc9c5
31 changed files with 535 additions and 190 deletions
+43 -26
View File
@@ -111,44 +111,61 @@ class TestDatabaseModel(SupersetTestCase):
db = get_example_database()
table_name = "energy_usage"
sql = db.select_star(table_name, show_cols=False, latest_partition=False)
quote = db.inspector.engine.dialect.identifier_preparer.quote_identifier
expected = (
textwrap.dedent(
f"""\
SELECT *
FROM {quote(table_name)}
LIMIT 100"""
)
if db.backend in {"presto", "hive"}
else textwrap.dedent(
f"""\
SELECT *
FROM {table_name}
LIMIT 100"""
)
if db.backend != "presto"
else textwrap.dedent(
f"""\
SELECT *
FROM "{table_name}"
LIMIT 100"""
)
)
assert expected in sql
sql = db.select_star(table_name, show_cols=True, latest_partition=False)
expected = (
textwrap.dedent(
f"""\
SELECT source,
target,
value
FROM {table_name}
LIMIT 100"""
# TODO(bkyryliuk): unify sql generation
if db.backend == "presto":
assert (
textwrap.dedent(
"""\
SELECT "source" AS "source",
"target" AS "target",
"value" AS "value"
FROM "energy_usage"
LIMIT 100"""
)
== sql
)
if db.backend != "presto"
else textwrap.dedent(
f"""\
SELECT "source" AS "source",
"target" AS "target",
"value" AS "value"
FROM "{table_name}"
LIMIT 100"""
elif db.backend == "hive":
assert (
textwrap.dedent(
"""\
SELECT `source`,
`target`,
`value`
FROM `energy_usage`
LIMIT 100"""
)
== sql
)
else:
assert (
textwrap.dedent(
"""\
SELECT source,
target,
value
FROM energy_usage
LIMIT 100"""
)
in sql
)
)
assert expected in sql
def test_select_star_fully_qualified_names(self):
db = get_example_database()