-1

I want to use ms access db with flask frame work. my question is How to configure it and how to store data in ms access db with json format.

davidism
  • 121,510
  • 29
  • 395
  • 339
san
  • 1
  • 3

1 Answers1

0

This can be achieved by using the pyodbc library:

Create a connection:

cnxn = pyodbc.connect('"Driver={Microsoft Access Driver (*.mdb)};DBQ=<path to MDB>;"')
cursor = cnxn.cursor()

Select example:

cursor.execute("select user_id, user_name from users")
row = cursor.fetchone()
if row:
    print(row)

Delete example:

cursor.execute("delete from products where id <> ?", 'pyodbc')
print('Deleted {} inferior products'.format(cursor.rowcount))
cnxn.commit()

The official documentation with installation instructions can be found here: http://mkleehammer.github.io/pyodbc/

Igor
  • 2,834
  • 2
  • 26
  • 44