MCPcopy Create free account
hub / github.com/apache/impala / load_data

Function load_data

testdata/bin/load-tpc-kudu.py:57–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 impala.drop_db_if_exists(target_db)
56
57def load_data():
58 sql_params = {
59 "source_db_name": source_db,
60 "target_db_name": target_db,
61 "kudu_master": kudu_master,
62 "buckets": buckets}
63
64 sql_file_path = get_test_file_path(workload)
65 with open(sql_file_path, "r") as test:
66 queries = sqlparse.split(test.read())
67
68 with cluster.impala.cursor() as impala:
69 impala.create_db_if_not_exists(target_db)
70 impala.execute("USE %s" % target_db)
71 for query in queries:
72 query = sqlparse.format(query.rstrip(';'), strip_comments=True)
73 query_str = query.format(**sql_params)
74 if (len(query_str)) == 0: continue
75 if verbose: print(query_str)
76 impala.execute(query_str)
77
78def get_test_file_path(workload):
79 if "IMPALA_HOME" not in os.environ:

Callers 2

load-tpc-kudu.pyFile · 0.70

Calls 6

get_test_file_pathFunction · 0.70
readMethod · 0.45
cursorMethod · 0.45
executeMethod · 0.45
formatMethod · 0.45

Tested by 1