Update regular expression for mdbtools 1.0 output

The output formatting has changed - it now puts multiple data rows in a
single INSERT statement, and also changes the quoting of text data.
This commit is contained in:
2024-01-20 23:36:51 +02:00
parent 0267b8b59f
commit 13957160f8

View File

@@ -439,7 +439,8 @@ CREATE VIEW IF NOT EXISTS Capacity_View
def mdb_get_data_text(s3db, filename, table): def mdb_get_data_text(s3db, filename, table):
print("Reading %s..." % table) print("Reading %s..." % table)
insert_pattern = re.compile( insert_pattern = re.compile(
r'INSERT INTO "\w+" \([^)]+?\) VALUES \(("[^"]*"|[^")])+?\);\n', re.IGNORECASE r"""INSERT INTO "\w+" \([^)]+?\) VALUES (\((('[^']*')|"[^"]*"|[^')])+?\),?\s*)+;\n""",
re.IGNORECASE,
) )
try: try:
# Initialize values to avoid NameError in except clause # Initialize values to avoid NameError in except clause