[Mysql] Python Sql query Format Error
ยท
๐Ÿ›ข๏ธ Database
#10.5.4 MySQLCursor.execute() Method cursor.execute(operation, params=None, multi=False) iterator = cursor.execute(operation, params=None, multi=True) This method executes the given database operation (query or command). The parameters found in the tuple or dictionary params are bound to the variables in the operation. Specify variables using %s or %(name)s parameter style (that is, using format..
[Mysql] Pymysql INSERT ์ฟผ๋ฆฌ ์ƒ์„ฑ๊ธฐ
ยท
๐Ÿ›ข๏ธ Database
def input_sql(data, input_table_name, pk=None): """ data: Input Data DataFrame input_table_name: Table name Str pk: Primary Key Name List """ colnames = list(data.columns) INPUT_NAME = '' for col in colnames: INPUT_NAME = INPUT_NAME + col.upper() +',' INPUT_NAME = INPUT_NAME[:-1] VALUES_INPUT = '' for col in colnames: VALUES_INPUT = VALUES_INPUT +'"%s",' VALUES_INPUT = VALUES_INPUT[:-1] sql = f"..
๋‹คํ–ˆ๋‹ค
'๐Ÿ›ข๏ธ Database' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (4 Page)