Error: CMySQLCursor.executemany() missing 1 required positional argument: 'seq_params'

Advertisements I’am working on flask application, and I want to initilize the db when i start the application, so i create a schema file: schema.sql file contains: — Drops DROP TABLE IF EXISTS `article`; DROP TABLE IF EXISTS `book`; DROP TABLE IF EXISTS `settings`; — Article CREATE TABLE `article` ( `id` int NOT NULL AUTO_INCREMENT,… Read More Error: CMySQLCursor.executemany() missing 1 required positional argument: 'seq_params'

NameError: name 'dishID' is not defined. Did you mean: 'dishid'?

Advertisements this is the code of the following function Function: def dishID(): query = ‘select count(*), max(DishID) from Dish’ cur.execute(query) fetch = cur.fetchall() for i in fetch: if i[0] == 0: return 1 else: return (int(i[1]) + 1) Error code dishname = input(‘Enter Dish Name: ‘) dishprice = input(‘Enter Dish Price: ‘) dishid = str(dishID())… Read More NameError: name 'dishID' is not defined. Did you mean: 'dishid'?

Let Join C++ MYSQL library

Advertisements I’m trying to access "category" table with LEFT JOIN. I need to retrieve the field "name" in this table. This is my code: void Product::read(MYSQL *connection) { MYSQL_RES *result; MYSQL_ROW row; if(mysql_query(connection, "SELECT * FROM product LEFT JOIN category ON product.category=category.category_id")) std::cout<<"Query failed!!"<<mysql_error(connection)<<std::endl; else result=mysql_store_result(connection); if(result->row_count>0) { while(row=mysql_fetch_row(result)) { std::cout<<"Name: "<<row[1]<<" Brand: "<<row[3]<<" Price:… Read More Let Join C++ MYSQL library

SQL syntax error when passing datetime into execute code

Advertisements I’m working on sql project in python and I having some problem here seeking for help. I have a list variable and I want to insert the datetime into sql module: mysql-connector , IDE: vscode here’s the variable data_lst =[[‘2020-12-13 13:00:00′,2,3,4,5]] dttime = str(data_lst[z][0]) here’s the code #dttime is in datetime format insert_data =… Read More SQL syntax error when passing datetime into execute code

Not Working filter search using python and mysql

Advertisements it is showing me no record after writing the 1, I have data on my database for 1 can someone please help me to know where I am wrong here! def searchDB(): try: sqlCon = mysql.connect(host="localhost",user="root",password="*********",database="mydatabase") cur =sqlCon.cursor () cur.execute ("select categoryname from category where "+ str(searchby.get())+ "Like ‘%" + str(search.get()) + "Like ‘%’")… Read More Not Working filter search using python and mysql

update query python mysql.connector

Advertisements I’m doing a web scraping project and now I’m trying to store my data into a MySQL database (remote server). I’m sure the DB config is done write, but I keep getting this error: Traceback (most recent call last): File "C:**\main.py", line 14, in <module> cnx.commit() File "C:**\mysql\connector\connection_cext.py", line 406, in commit self._cmysql.commit() _mysql_connector.MySQLInterfaceError:… Read More update query python mysql.connector