Category : python-db-api

”’Setting the characteristics of the connection to the database”’ dbconfig={‘host’:’127.0.0.1′, ‘user’:’root’, ‘password’:”, ‘database’:’vsearchlogDB’} ”’On the command line, I write import mysql. connector ”’ import mysql.connector ”’ Next, I establish a connection to the server ”’ conn=mysql.connector.connect(**dbconfig) ”’Then I open the cursor ”’ cursor=conn.cursor() """I’m starting to work with SQL """ _SQL="""insert into log (prase, letters, ..

Read more

Just new to python programming, Django SQL, and try to create a DB, verify it with Postman and SQLLiteStudio! Using Django to create a DB and python (3.9.6).When I run the DELETE method, in postman return error 500 without executing DELETE. {In my cmd I don’t see any error msg} [error msg in Postman trying ..

Read more

Assuming I have a database myDatabase with a row: ID = 0, name = ‘myName’ I can get the ID value (assuming I’m connected) by using either: cursor.execute("""SELECT ID FROM myDatabase WHERE %s = %s""" % (‘name’, ‘myName’)) print(cursor.fetchone()) or cursor.execute("""SELECT ID FROM myDatabase WHERE {} = {}""".format(‘name’, ‘myName’)) print(cursor.fetchone()) which both work perfectly fine ..

Read more

I’m trying to stablish connection with Microsoft Office and to run a query but it is showing error Here is my code: import pyodbc conn = pyodbc.connect(r’DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=E:PythonDatabaseatt2000.accdb;’) cursor = conn.cursor() cursor.execute("SELECT CHECKINOUT FROM att2000 Where CHECKTYPE = O") for row in cursor.fetchall(): print (row) Here is the error: Error is occurring ..

Read more