Skip to content
Advertisement

Tag: sql

psycopg2 SyntaxError with time or date

I have a code that automatically identifies for what table, which columns and what the values to parse into sql insert statement. It works well with all of my tables, except only one. This is a structure of the model of this table: I got SyntaxError only with this table. My insertion statement: This is an error: It’s says in

Python SQL Insert script

I’m creating a Python script to insert some records in a table, but have the following problem: I get the error: “Invalid column name ‘ADIDAS | KID’S STAN SMITH’ How can I fix this with Python? Answer Let’s say this is your tuple:

Assign outcome from SQL query to column

I have a dataframe (test_df) that looks like this: I want to assign the result from executing the query in dq_sql to the column Results. I tried this: which results in: Strange thing is, the ‘X’ result should be assigned to row 1, whereas the query in row 0 does not seem to run. When I try to run the

How can I Insert multiple rows with one query

I made a code allowing me to GET data from an API and insert it into a database. But I encounter a problem my api contains about 20 million data and to insert everything in my database it will take me 43 days :) I think the problem comes from the fact that I insert the data one by one.

Iterating through records with SQL INSERT activated stops after first set of INSERTS, but using PRINT to test goes through EVERY record (as desired)

Python 3.10.2 with sqlite3 on Windows 10. Relatively new to Python, but I was quite experienced with Perl around 1997-2005. Banged my head against this for three days. Attacked from lots of angles. No success. I’m asking for guidance, because I don’t see myself progressing on my own at this point without help flipping on the light-switch. My overall application

Advertisement