Cant Create tables in access with pyodbc

Additional solutions that do not require a manual commit are:

Set autocommit = True when the connection instance is created.

Eg:

con = pyodbc.connect(your_connection_string, autocommit = True)

OR

Use a with statement that, according to Python Database connection Close, will commit anything before the connection is deleted at the end of the with block.

Eg:

with pyodbc.connect(your_connection_string) as con:

    CREATE_TABLE_CODE_WITHOUT_COMMIT

UNRELATED_CODE

You need to commit the transaction:

import pyodbc

con = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=Z:\Data\Instruments\testDB.accdb; Provider=MSDASQL;')
cur = con.cursor()
string = "CREATE TABLE TestTable(symbol varchar(15), leverage double, shares integer, price double)"
cur.execute(string)
con.commit()