Skip to content

Commit 33257e7

Browse files
authored
Merge pull request #229 from mkazia-db/master
Do not update DDL with LOCATION for views
2 parents 6b1abd1 + aa8bcf2 commit 33257e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dbclient/HiveClient.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ def update_table_ddl(self, local_table_path, db_path):
102102
# check if the database location / path is the default DBFS path
103103
table_name = os.path.basename(local_table_path)
104104
is_db_default_path = db_path.startswith('dbfs:/user/hive/warehouse')
105-
if (not is_db_default_path) and (not self.is_table_location_defined(local_table_path)):
105+
ddl_statement = self.get_ddl_by_keyword_group(local_table_path)
106+
if (not is_db_default_path) and (not self.is_table_location_defined(local_table_path)) and (not self.is_ddl_a_view(ddl_statement)):
106107
# the LOCATION attribute is not defined and the Database has a custom location defined
107108
# therefore we need to add it to the DDL, e.g. dbfs:/db_path/table_name
108109
table_path = db_path + '/' + table_name
@@ -656,4 +657,4 @@ def get_or_launch_cluster(self, cluster_name=None):
656657
# is not persisted and checkpointed on system crash.
657658
def _persist_to_disk(self, fp):
658659
fp.flush()
659-
os.fsync(fp.fileno())
660+
os.fsync(fp.fileno())

0 commit comments

Comments
 (0)