28 lines
996 B
Python
28 lines
996 B
Python
# Debug JSON escaping for SQL generation
|
|
s = '["321181","321100"]'
|
|
print('Raw:', s)
|
|
print('repr:', repr(s))
|
|
|
|
# In Python f-string, the value s contains backslash-escaped quotes
|
|
# So when written to SQL file, it should produce:
|
|
# '["321181","321100"]'
|
|
# (the single quotes are SQL string delimiters)
|
|
|
|
# Current code: region_scope = '["321181","321100"]'
|
|
# When this gets into an f-string:
|
|
region_scope_val = '["321181","321100"]'
|
|
line = f"('{region_scope_val}', ..."
|
|
print('Generated line:', line)
|
|
print()
|
|
|
|
# The problem: in the SQL file, it should look like:
|
|
# ('user_id', ..., '["321181","321100"]', ...)
|
|
# But what we actually get depends on how it's written
|
|
|
|
# Let's check what the file actually contains
|
|
test_line = f"('{region_scope_val}', 'required', ['\"never_married\"'], 'required', 'bachelor', 'preferred')"
|
|
print('Test line:', test_line)
|
|
print()
|
|
print('Expected SQL: region_scope should be a JSON string literal')
|
|
print('Correct format: \\'["321181","321100"]\\' in the SQL file')
|