Skip to content

Commit faf81b3

Browse files
committed
Handle spaces in quoted table/schema names when parsing datasources
1 parent 84ad046 commit faf81b3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/config_generator/qgs_reader.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ def extract_datasource_filter(match):
758758
state = 'key' # can be 'key', 'before_value', 'value'
759759
quote_char = None
760760
escape = False
761+
in_dquote = False
761762

762763
def commit():
763764
nonlocal key, value, state, quote_char
@@ -767,6 +768,7 @@ def commit():
767768
value = ''
768769
state = 'key'
769770
quote_char = None
771+
in_dquote = False
770772

771773
i = 0
772774
while i < len(datasource):
@@ -791,6 +793,8 @@ def commit():
791793
elif not c.isspace():
792794
state = 'value'
793795
value += c
796+
if c == '"':
797+
in_dquote = True
794798

795799
elif state == 'value':
796800
if escape:
@@ -804,10 +808,12 @@ def commit():
804808
else:
805809
value += c
806810
else:
807-
if c.isspace():
811+
if c.isspace() and not in_dquote:
808812
commit()
809813
else:
810814
value += c
815+
if c == '"':
816+
in_dquote = not in_dquote
811817
i += 1
812818

813819
# Final token

0 commit comments

Comments
 (0)