mysql-python

Why does MySQL return error on creating a table?

Why does MySQL return error on creating a table? Question: I’ve been trying to create a table with user input name but I get an error no matter how I write the query. right now query is like this: query=("CREATE TABLE "+t+" ( NAME VARCHAR , DISTANCE VARCHAR , PRICE VARCHAR , LOCATION VARCHAR)") and …

Total answers: 1

How to join different dataframe with specific criteria?

How to join different dataframe with specific criteria? Question: In my MySQL database stocks, I have 3 different tables. I want to join all of those tables to display the EXACT format that I want to see. Should I join in mysql first, or should I first extract each table as a dataframe and then …

Total answers: 1

You have an error in your SQL syntax error appearing with correct syntax

You have an error in your SQL syntax error appearing with correct syntax Question: I am making an app in python flask, and I executed a sql query. I am using Mysql server 8.0. My code is: mydb = mysql.connector.connect( host="localhost", user="…", password="…..", database="….." ) cursor = mydb.cursor() sql = "INSERT INTO calender_events (class,date,title,desc) VALUES …

Total answers: 1

Insert list into MySQL database using Python

Insert list into MySQL database using Python Question: I am doing a classification using k-nearest neighbor with python. The data I am using is float type, latitude and longitude and get the output from it like this: prediction preds2 = model.predict(new_list) print(type(preds2)) print(preds2) print("———–") print(new_list) print(type(new_list)) print("———–") Output prediction not merged <class ‘numpy.ndarray’> [‘Taman Suaka …

Total answers: 1

The website does not remove elements, despite the prescribed code

The website does not remove elements, despite the prescribed code Question: I have a code that can add, change or delete data. Adding and changing works well, but deleting doesn’t work. There is simply no response to pressing the button. What is the reason? views.py: from django.shortcuts import render from django.views.generic import ListView, DetailView, CreateView, …

Total answers: 1

Python MySql Connector Not enough parameters for the SQL statement

Python MySql Connector Not enough parameters for the SQL statement Question: Can’t Insert Values into MySql Database Using This Piece Of Code: def CreateUser(Name, Password, Email, Version): global user print(Password) user = [tuple(Name), tuple(Email), tuple(Password), tuple("User"), tuple("0"), tuple(Version)] my_cursor.executemany(f"INSERT INTO users (usersUid, usersEmail, usersPwd, UsersPerms, usersMoney, gameVersion) VALUES (%s, %s, %s, %s, %s, %s)", user) …

Total answers: 1

Python Django use mysql function SHA2('pass',256)

Python Django use mysql function SHA2('pass',256) Question: I am creating application in Django and now I want create table with username and password. Right now, we generating password with mysql function SHA2(‘password’,256) and my question… is possible use it the same in Django model? I mean everything what will be save to password row, will …

Total answers: 1

MySQL-Python Wont create the table

MySQL-Python Wont create the table Question: I am trying to create a few tables using Python, the first few worked and this specific one not. This is my code: sql = "CREATE TABLE citizens( ID INT PRIMARY KEY AUTO_INCREMENT, full_name VARCHAR(100), age INT, Gender ENUM(‘F’, ‘M’), cultivation VARCHAR(100), rank INT, isRouge ENUM(‘Yes’, ‘No’), sect_id INT)" …

Total answers: 3

MySQLdb._exceptions.ProgrammingError: not enough arguments for format string

MySQLdb._exceptions.ProgrammingError: not enough arguments for format string Question: I am trying to take a list of dictionaries, which is the return from a job’s board API, and insert that data into a SQL table for one of my teammates to access. The issue that I am running into is that when I run my script …

Total answers: 2