From 13957160f842a3fedd808b24398e05cc2802efec Mon Sep 17 00:00:00 2001 From: Chris Kerr Date: Sat, 20 Jan 2024 23:36:51 +0200 Subject: [PATCH] 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. --- galvani/res2sqlite.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/galvani/res2sqlite.py b/galvani/res2sqlite.py index 2329473..591b945 100755 --- a/galvani/res2sqlite.py +++ b/galvani/res2sqlite.py @@ -439,7 +439,8 @@ CREATE VIEW IF NOT EXISTS Capacity_View def mdb_get_data_text(s3db, filename, table): print("Reading %s..." % table) insert_pattern = re.compile( - r'INSERT INTO "\w+" \([^)]+?\) VALUES \(("[^"]*"|[^")])+?\);\n', re.IGNORECASE + r"""INSERT INTO "\w+" \([^)]+?\) VALUES (\((('[^']*')|"[^"]*"|[^')])+?\),?\s*)+;\n""", + re.IGNORECASE, ) try: # Initialize values to avoid NameError in except clause