Skip to content

Commit

Permalink
Revert "Removed maximum size constraint when loading temp_table (#296)…
Browse files Browse the repository at this point in the history
…" (#299)

This reverts commit 6da0d25.
  • Loading branch information
cjohns-scottlogic authored Dec 4, 2024
1 parent c945a91 commit 64d59c8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions digital_land/package/datasetparquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ def create_temp_table(self, input_paths):
# Initial max_line_size and increment step
max_size = 40000000
increment_step = 20000000
# max_limit = 200000000 # Maximum allowable line size to attempt
max_limit = 200000000 # Maximum allowable line size to attempt

increment = False
while True:
try:
query = f"""
Expand All @@ -85,13 +84,15 @@ def create_temp_table(self, input_paths):
)
"""
self.conn.execute(query)
if increment:
logging.info(f"Ended up needing a value of max_size = {max_size}")
break
except duckdb.Error as e: # Catch specific DuckDB error
if "Value with unterminated quote" in str(e):
increment = True
max_size += increment_step
if max_size > max_limit:
print(
f"Exceeded max_limit of {max_limit}. Could not resolve the issue."
)
raise
else:
raise

Expand Down

0 comments on commit 64d59c8

Please sign in to comment.