From afd677b9fd094e0ab7345843ddfb337378151b9e Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Tue, 13 Oct 2020 11:42:30 +0200 Subject: [PATCH] Improve table name extraction --- datasette_connectors/cursor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datasette_connectors/cursor.py b/datasette_connectors/cursor.py index 166c84e..f3898cc 100644 --- a/datasette_connectors/cursor.py +++ b/datasette_connectors/cursor.py @@ -54,7 +54,7 @@ class Cursor: match = re.search(r'select count\(\*\) from (.*)', sql) results = [{'count(*)': self.connector.table_count(match.group(1))}] elif sql.startswith("PRAGMA table_info("): - match = re.search(r'PRAGMA table_info\((.*)\)', sql) + match = re.search(r'PRAGMA table_info\(\[?\"?([\d\w\/]*)\"?\]?\)', sql) results = self.connector.table_info(match.group(1)) elif sql.startswith("select name from sqlite_master where rootpage = 0 and ( sql like \'%VIRTUAL TABLE%USING FTS%content="): match = re.search(r'select name from sqlite_master where rootpage = 0 and \( sql like \'%VIRTUAL TABLE%USING FTS%content="(.*)"', sql) -- 2.39.5