Skip to content

Commit

Permalink
Fixed regex syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoiv committed Aug 6, 2021
1 parent 50c6bb1 commit 946a5a3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- `insert_into_orc_table` function can now use overwrite option

### Changed
- Fixed incorrect regex matching syntax in detection of `INSERT OVERWRITE` commands

## [1.6.3] 2021-06-14

### Changed
Expand Down
2 changes: 1 addition & 1 deletion honeycomb/__danger.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __nuke_partition(table_name, schema, partition_values):
'{}=\'{}\''.format(partition_key, partition_value)
for partition_key, partition_value in partition_values.items()])
partition_metadata = hive.run_lake_query(
'DESCRIBE FORMATTED {}.{} PARTITON ({})'.format(
'DESCRIBE FORMATTED {}.{} PARTITION ({})'.format(
schema, table_name, partition_string),
engine='hive'
)
Expand Down
4 changes: 2 additions & 2 deletions honeycomb/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def run_lake_query(query, engine='hive', complex_join=False):
'honeycomb for bucket integrity reasons.'
)
schema, table_name = re.search(
r'INSERT *OVERWRITE *TABLE *(\w+)\.(\w+)', query,
flags=re.IGNORECASE).groups()
r'INSERT *OVERWRITE *(TABLE)? *(\w+)\.(\w+)', query,
flags=re.IGNORECASE).groups()[1:]

_, table_s3_path = get_table_s3_location(table_name, schema)
if not _hive_check_valid_table_path(table_s3_path):
Expand Down
4 changes: 2 additions & 2 deletions honeycomb/orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def insert_into_orc_table(table_name, schema, source_table_name, source_schema,
['source_table.{}="{}"'.format(partition_key, partition_value)
for partition_key, partition_value in partition_values.items()])
insert_command = (
'INSERT {} {}.{}{}\n'.format(insert_type, schema, table_name,
partition_strings) +
'INSERT {} TABLE {}.{}{}\n'.format(insert_type, schema, table_name,
partition_strings) +
'SELECT\n'
' {}\n'.format(',\n '.join(col_names)) +
'FROM {}.{} source_table'.format(source_schema, source_table_name) +
Expand Down

0 comments on commit 946a5a3

Please sign in to comment.