+ 2

How can you link a SQL file and a Python program?

How can you open, edit, and view a table via SQL in Python, for example, the inteaction with the user happens in Python, like adding values, and you transfer that data from Python to SQL, or opening the table via Python?

3rd Mar 2018, 6:49 PM
Nico Orfa
3 Answers
+ 5
import sqlite3 database = sqlite3.connect("example.db") db = database.cursor() db.execute("CREATE TABLE table (col1 TEXT, col2 TEXT)") db.execute("INSERT INTO table VALUES ('hello', 'world')") database.commit() print(db.execute("SELECT * FROM table").fetchall())
4th Mar 2018, 4:13 AM
Fox
Fox - avatar
+ 3
Take a look at the SQLAlchemy module â˜ș
3rd Mar 2018, 7:47 PM
Pedro Demingos
Pedro Demingos - avatar
+ 1
There's mysql connector libraries for python
3rd Mar 2018, 7:36 PM
Toni Isotalo
Toni Isotalo - avatar