vutran1710/PyrateLimiter

SQLite Backend hard coded filename

Opened this issue · 1 comments

The Documentation for SQLite Backend does not mention the init_from_file function that is necessary to have the Table created. However that file has a hard coded "./mydb.sqlite", location. However if I pass in a connection and table using the example provided:

conn = sqlite3.connect(
    "async_test.sqlite",
    isolation_level="EXCLUSIVE",
    check_same_thread=False,
)
bucket = SQLiteBucket(rates, conn, "pyrate_table")

The table pyrate_table does not exist and the job fails with:

sqlite3.OperationalError: no such table: pyrate_table

Seems like there are a couple of possible action items:

  • Allow filename path for init_from_file
  • During SQLiteBucket initialization observe whether the table_name exists, and create if not

Sorry I got quite busy lately. Will fix it soon.