Search results
I am working with python, MySQL and multithreading, and really newbie in all of this; however, I am trying to do multiple sql queries at 3 threadings I have. That threads consist in general loop that is reading a specific table from database. I am using just one database. I use mysql.connector provided by MySQL for Windows.
After reading some MySQL documentation I realised that MySQL uses the %s placeholder in a different way both in the SQL query and in the cursor execution statement. See below: mysql = "SELECT * FROM tbl_colours WHERE pc_name = % (pc_name)s". mycursor.execute (mysql, {'pc_name': mycmb}) This works perfectly.
I am working on code to create a simple MySQL table and I want a number value to have decimals. I used the DECIMAL data type and specified the digits and decimal places: CREATE TABLE products3 (product VARCHAR (255), price DECIMAL (12,2), PRIMARY KEY (product)) I am able to commit data to it but when I select the data the number value looks ...
root@FireDragon:~# pip3 install mysql-connector-python Collecting mysql-connector-python Downloading mysql_connector_python-8.0.28-cp39-cp39-manylinux1_x86_64.whl (37.6 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 37.6/37.6 MB 2.6 MB/s eta 0:00:00 Collecting protobuf>=3.0.0 Downloading protobuf-3.19.4-cp39-cp39 ...
New to python, I'm trying to do a ssh to one of the linux box using paramiko, I can already do this activity but I want to pick the credentials from mysql database instead from the conf.py file. Here's my my sql connector script i'm testing, I get the output of two rows, username and password but how do I pick the "Username" column's value as a variable and "Password's" column value as a ...
Hi all I am getting this error" Not all parameters were used in the SQL statement" when I try to insert values in mysql database through a Tkinter GUI. Can somebody help. here is my code. var1.set("Clinic ID. ") Type "help", "copyright", "credits" or "license()" for more information.
The official dedicated python forum. Larz60+ write Jul-31-2022, 12:48 PM: Please post all code, output and errors (it it's entirety) between their respective tags.
The official dedicated python forum Hello everyone, Can anyone advice how to handle empty string or None when insert data in mysql integer column. Here is the code i have: import mysql.connector cnx = mysql.connector.connect(user='user'
Hello, I am pretty new to python I am wondering is this is the correct syntax to get the last row id in a my=sql mysql table? cur=conn.cursor() sql='SELECT row_id FROM test_tb ORDER BY row_id DESC LIMIT 1' cur.execute(sql) last_id = cur.fetchone() fo...
1. mysql-connector-python. I connect to my db using the following command: 1. myConnection = mysql.connector.connect(host=hostname, user=username, passwd=password, db=database, autocommit=true, auth_plugin = "mysql_native_password") I have started noticing very strange issues with my python program. I have been testing it for a while and can ...