|
@@ -143,7 +143,7 @@ class HiveServer2Dbms(object):
|
|
|
|
|
|
|
|
|
|
|
|
|
def select_star_from(self, database, table):
|
|
def select_star_from(self, database, table):
|
|
|
- hql = "SELECT * FROM `%s.%s` %s" % (database, table.name, self._get_browse_limit_clause(table))
|
|
|
|
|
|
|
+ hql = "SELECT * FROM `%s`.`%s` %s" % (database, table.name, self._get_browse_limit_clause(table))
|
|
|
return self.execute_statement(hql)
|
|
return self.execute_statement(hql)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -189,7 +189,7 @@ class HiveServer2Dbms(object):
|
|
|
if table.partition_keys:
|
|
if table.partition_keys:
|
|
|
partitions = self.get_partitions(database, table, 1)
|
|
partitions = self.get_partitions(database, table, 1)
|
|
|
partition_query = 'WHERE ' + ' AND '.join(["%s='%s'" % (table.partition_keys[idx].name, key) for idx, key in enumerate(partitions[0].values)])
|
|
partition_query = 'WHERE ' + ' AND '.join(["%s='%s'" % (table.partition_keys[idx].name, key) for idx, key in enumerate(partitions[0].values)])
|
|
|
- hql = "SELECT * FROM `%s.%s` %s LIMIT %s" % (database, table.name, partition_query, limit)
|
|
|
|
|
|
|
+ hql = "SELECT * FROM `%s`.`%s` %s LIMIT %s" % (database, table.name, partition_query, limit)
|
|
|
query = hql_query(hql)
|
|
query = hql_query(hql)
|
|
|
handle = self.execute_and_wait(query, timeout_sec=5.0)
|
|
handle = self.execute_and_wait(query, timeout_sec=5.0)
|
|
|
|
|
|
|
@@ -301,9 +301,9 @@ class HiveServer2Dbms(object):
|
|
|
|
|
|
|
|
def drop_table(self, database, table):
|
|
def drop_table(self, database, table):
|
|
|
if table.is_view:
|
|
if table.is_view:
|
|
|
- hql = "DROP VIEW `%s.%s`" % (database, table.name,)
|
|
|
|
|
|
|
+ hql = "DROP VIEW `%s`.`%s`" % (database, table.name,)
|
|
|
else:
|
|
else:
|
|
|
- hql = "DROP TABLE `%s.%s`" % (database, table.name,)
|
|
|
|
|
|
|
+ hql = "DROP TABLE `%s`.`%s`" % (database, table.name,)
|
|
|
|
|
|
|
|
return self.execute_statement(hql)
|
|
return self.execute_statement(hql)
|
|
|
|
|
|
|
@@ -314,7 +314,7 @@ class HiveServer2Dbms(object):
|
|
|
if form.cleaned_data['overwrite']:
|
|
if form.cleaned_data['overwrite']:
|
|
|
hql += " OVERWRITE"
|
|
hql += " OVERWRITE"
|
|
|
hql += " INTO TABLE "
|
|
hql += " INTO TABLE "
|
|
|
- hql += "`%s.%s`" % (database, table.name,)
|
|
|
|
|
|
|
+ hql += "`%s`.`%s`" % (database, table.name,)
|
|
|
if form.partition_columns:
|
|
if form.partition_columns:
|
|
|
hql += " PARTITION ("
|
|
hql += " PARTITION ("
|
|
|
vals = []
|
|
vals = []
|
|
@@ -335,9 +335,9 @@ class HiveServer2Dbms(object):
|
|
|
|
|
|
|
|
for table in tables:
|
|
for table in tables:
|
|
|
if table.is_view:
|
|
if table.is_view:
|
|
|
- hql.append("DROP VIEW `%s.%s`" % (database, table.name,))
|
|
|
|
|
|
|
+ hql.append("DROP VIEW `%s`.`%s`" % (database, table.name,))
|
|
|
else:
|
|
else:
|
|
|
- hql.append("DROP TABLE `%s.%s`" % (database, table.name,))
|
|
|
|
|
|
|
+ hql.append("DROP TABLE `%s`.`%s`" % (database, table.name,))
|
|
|
query = hql_query(';'.join(hql), database)
|
|
query = hql_query(';'.join(hql), database)
|
|
|
design.data = query.dumps()
|
|
design.data = query.dumps()
|
|
|
design.save()
|
|
design.save()
|
|
@@ -350,7 +350,7 @@ class HiveServer2Dbms(object):
|
|
|
|
|
|
|
|
for table in tables:
|
|
for table in tables:
|
|
|
try:
|
|
try:
|
|
|
- hql = "INVALIDATE METADATA %s.%s" % (database, table,)
|
|
|
|
|
|
|
+ hql = "INVALIDATE METADATA `%s`.`%s`" % (database, table,)
|
|
|
query = hql_query(hql, database, query_type=QUERY_TYPES[1])
|
|
query = hql_query(hql, database, query_type=QUERY_TYPES[1])
|
|
|
|
|
|
|
|
handle = self.execute_and_wait(query, timeout_sec=10.0)
|
|
handle = self.execute_and_wait(query, timeout_sec=10.0)
|
|
@@ -586,7 +586,7 @@ class HiveServer2Dbms(object):
|
|
|
for idx, key in enumerate(partitions[partition_id].values):
|
|
for idx, key in enumerate(partitions[partition_id].values):
|
|
|
partition_query += (idx > 0 and " AND " or "") + table.partition_keys[idx].name + "='%s'" % key
|
|
partition_query += (idx > 0 and " AND " or "") + table.partition_keys[idx].name + "='%s'" % key
|
|
|
|
|
|
|
|
- hql = "SELECT * FROM `%s.%s` WHERE %s" % (db_name, table_name, partition_query)
|
|
|
|
|
|
|
+ hql = "SELECT * FROM `%s`.`%s` WHERE %s" % (db_name, table_name, partition_query)
|
|
|
|
|
|
|
|
return self.execute_statement(hql)
|
|
return self.execute_statement(hql)
|
|
|
|
|
|