Skip to content

Tag: mysql

How to put db name into query using %s

I have a following sql query: The tableA is in db-jablonec so I need to call db-jablonec.tableA. I use this method in Python: I call it like this: But I got an error MySQLdb.ProgrammingError: (1146, “Table ”db-jablonec’.tableA’ doesn’t exist”) Obviously, I want to call ‘db-jablonec.tableA’ not ”db-jablonec’.tableA’. How can I fix it please? Answer It is passing %s as its

INSERT table names using SELECT statement in MySQL

In MySQL, I know I can list the tables in a database with: But I want to insert a table name into a specified table, for example: But when I execute the above statement, the dataset_names table does not get updated. I created the master table using: Here is the python code. Answer Here the order on insert values and

How to store CSV file in database?

There is a output file from Python Pandas with a lot of columns with headers. I need to be able handle this file by script and get CSV files in different columns positions. For example, initial file has columns As variation I need to get it in different sequence: I wonder what is the best way to store this file

Dropdown list issues

I’ve also been trying to set a default value in a dropdown box on HTML from the data I retrieved from MySQL. However, I noticed that if the user did not click on the dropdown box and clicked on one item from it. In other words, if they assumed the displayed value is the value they would like to submit

How to put date(parsed from csv) in Python to mysql?

I’ve made separate simple example just to check what method would work with date in my case and didn’t find any solution. we have: db table: code CSV file example_v2.csv: Trace Could you please assist in even find the documentation fit my case or indicate the direction. I’ve already tried a lot of methods such as: etc. Answer thanks to

POST on MYSQL database done in terminal but nothing in my base

I would like to know why all seems to be okay but nothing is insert in my mysql database ? I get some data from an api and I would like to insert data in table. Using flask, python, pymysql Thanks in advance traceback Answer You need to commit your table changes by doing immediately after each INSERT or sequence