728x90
CASE 1)
(24.02.10)
'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'You and what army?"\nI guess they\'re talking about you and me\nBaby, nobody will l\' at line 23'
python dedent์์ backspace ์ฌ์ฉ ๋จ๋ฐ๋ก ์ ๋๋ก ๋ query๊ฐ ์ํ๋์ง ์์ ์๊ธฐ๋ ๋ฌธ์ ,,
Python ํน์ ๋ค๋ฅธ ์ธ์ด๋ค ๋๋ถ๋ถ ๋ค์ฌ ์ฐ๊ธฐ(indent)์ ๋ฏผ๊ฐํด sqlparse ๋ชจ๋๋ก query์ ์ค๋ฐ๊ฟ upper case๋ฅผ ์๋์ผ๋ก ์ ์ฒ๋ฆฌ ํด์ค ์ ์๋ค.
import sqlparse
raw = 'select * from foo; select * from bar;'
print(sqlparse.format(raw, reindent=True, keyword_case='upper'))
SELECT *
FROM foo;
SELECT *
FROM bar;
https://github.com/andialbrecht/sqlparse
๋ฐ์ํ
'๐ข๏ธ Database' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๋ฐ์ดํฐ ํ์ง์ ๋น๋ฐ (1) (0) | 2024.07.17 |
---|---|
[UNION ALL] Colum Row ๋ณํฉ (0) | 2024.02.16 |
[Airflow] airflow-init alembic.script.revision.ResolutionError: No such revision or branch ์ค๋ฅ (0) | 2023.12.20 |
[Airflow] airflow db ์ด๊ธฐํ ์ค๋ฅ (0) | 2023.12.20 |
[airflow] airflow root ๊ถํ docker ์ ์ (0) | 2023.11.26 |