실행한 직전 sql 확인하기
# cursor._last_executed 는 없어졌다고 하는듯하다.
cursor.statement
dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-statement.html
MySQL :: MySQL Connector/Python Developer Guide :: 10.5.15 MySQLCursor.statement Property
10.5.15 MySQLCursor.statement Property Syntax: str = cursor.statement This read-only property returns the last executed statement as a string. The statement property can be useful for debugging and displaying what was sent to the MySQL server. The string
dev.mysql.com
stackoverflow.com/questions/7071166/print-the-actual-query-mysqldb-runs
Print the actual query MySQLdb runs?
I'm looking for a way to debug queries as they are executed and I was wondering if there is a way to have MySQLdb print out the actual query that it runs, after it has finished inserting the parame...
stackoverflow.com
# 날짜 형식에 에러가 남
sql = 'SELECT %d, date_format(NOW(), '%Y-%m-%d') FROM DUAL'
print(sql % (1))
error
#아래와 같이 %%으로 해준다.
sql = SELECT date_format(NOW(), '%%Y-%%m-%%d') FROM DUAL
print(sql % (1))
pythonstudy.xyz/python/article/202-MySQL-%EC%BF%BC%EB%A6%AC
예제로 배우는 파이썬 프로그래밍 - MySQL 쿼리
1. MySQL DB 모듈 Python에서 MySQL 데이타베이스를 사용하기 위해 우선 Python DB API 표준을 따르는 MySQL DB 모듈을 다운받아 설치한다. MySQL DB 를 지원하는 Python 모듈은 여러 가지가 있는데, 여기서는 PyMyS
pythonstudy.xyz
PyFormat: Using % and .format() for great good!
Python has had awesome string formatters for many years but the documentation on them is far too theoretic and technical. With this site we try to show you the most common use-cases covered by the old and new style string formatting API with practical exam
pyformat.info
python 포맷팅 % 날짜 에러
Unsupported conversion_type: b'd'
ValueError: unsupported format character 'Y' (0x59) at index
[Solved][pymysql] ValueError: unsupported format character 'Y' (0x59) at index
pymysql을 통해 쿼리 입력할 때, 아래와 같은 오류 문구를 만나곤 한다. ValueError: unsupported format character 'Y' (0x59) at index 이는 쿼리의 변수 표현에 쓰이는 %s와 data format 변경하는 (예시..
growingsaja.tistory.com
DbApiFaq - Python Wiki
These are the frequently asked questions from the DB-SIG mailing list. How do I pass parameters to the cursor.execute method? Don't use the '%' concatenation operator, pass them as a series of extra parameters. For instance >>> cursor.execute("SELECT *
wiki.python.org
velog.io/@doondoony/python-sql-formatting
SQL Formatting in Python
파이썬에서 SQL 문을 작성하는 방법
velog.io
www.python.org/dev/peps/pep-0249/
PEP 249 -- Python Database API Specification v2.0
The official home of the Python Programming Language
www.python.org
unread result found 에러
unread result found 에러가 발생할 경우,
cursor()안에 아직 fetch()하지 않은 값이 남은 상태로 다음 sql을 execute할 때 발생
출처: https://tastydarr.tistory.com/entry/unread-result-found-에러 [맛동산]
tastydarr.tistory.com/entry/unread-result-found-%EC%97%90%EB%9F%AC
unread result found 에러
unread result found 에러가 발생할 경우, cursor()안에 아직 fetch()하지 않은 값이 남은 상태로 다음 sql을 execute할 때 발생 파이썬에서 쿼리문을 작성할 경우 (예, http://tastydarr.tistory.com/51) 무슨..
tastydarr.tistory.com
'Python' 카테고리의 다른 글
[Python] Python에서 시스템의 운영체제 확인하기 (0) | 2021.05.12 |
---|---|
[PYTHON/AWS] BOTO3 (0) | 2021.05.11 |
[python] mysql query 수행이력 보기 (0) | 2021.04.30 |
[PYTHON] SSE (feat. Flask)(Server-Sent Events) (0) | 2021.04.20 |
[python] 제너레이터와 yield 알아보기 (0) | 2021.04.20 |