Closed FridayPush closed 3 weeks ago
Sorry I got quite busy lately. Will fix it soon.
i can't even get it to work by hardcoding the mydb.sqlite:
def create_or_get_sqlite_bucket(bucketName, rates):
connection = sqlite3.connect("mydb.sqlite", isolation_level="EXCLUSIVE", check_same_thread=False)
bucket = SQLiteBucket(rates, connection, bucketName)
return bucket
returns:
sqlite3.OperationalError: no such table: myBucketTable
Issue acknowledged. Im going to fix it asap.
Issue acknowledged. Im going to fix it asap.
I appreciate your extremely quick response! In the meantime, I was considering going down the potential rabbit hole of overriding some sort of class. but if you are already implementing a fix so I can continue to treat it as "black box" code, then I would be most appreciative!!
Resolved! Try again if you have time and let me if it works for you @Silverlink34
I apologize for the late response, I just updated and am still getting the same error:
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 80, in __init__
self.bucket_factory = self._init_bucket_factory(argument, clock=clock)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 119, in _init_bucket_factory
argument = SingleBucketFactory(argument, clock)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 43, in __init__
self.schedule_leak(bucket, clock)
File "C:\Python312\Lib\site-packages\pyrate_limiter\abstracts\bucket.py", line 263, in schedule_leak
self._leaker.register(new_bucket, associated_clock)
File "C:\Python312\Lib\site-packages\pyrate_limiter\abstracts\bucket.py", line 134, in register
try_leak = bucket.leak(0)
^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pyrate_limiter\buckets\sqlite_bucket.py", line 118, in leak
count = self.conn.execute(query).fetchone()[0]
^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: openweathermap_bucket
I apologize for the late response, I just updated and am still getting the same error:
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 80, in __init__
self.bucket_factory = self._init_bucket_factory(argument, clock=clock)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 119, in _init_bucket_factory
argument = SingleBucketFactory(argument, clock)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 43, in __init__
self.schedule_leak(bucket, clock)
File "C:\Python312\Lib\site-packages\pyrate_limiter\abstracts\bucket.py", line 263, in schedule_leak
self._leaker.register(new_bucket, associated_clock)
File "C:\Python312\Lib\site-packages\pyrate_limiter\abstracts\bucket.py", line 134, in register
try_leak = bucket.leak(0)
^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pyrate_limiter\buckets\sqlite_bucket.py", line 118, in leak
count = self.conn.execute(query).fetchone()[0]
^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: openweathermap_bucket
Can you provide some code snippet?
I apologize for the late response, I just updated and am still getting the same error:
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 80, in __init__
self.bucket_factory = self._init_bucket_factory(argument, clock=clock)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 119, in _init_bucket_factory
argument = SingleBucketFactory(argument, clock)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 43, in __init__
self.schedule_leak(bucket, clock)
File "C:\Python312\Lib\site-packages\pyrate_limiter\abstracts\bucket.py", line 263, in schedule_leak
self._leaker.register(new_bucket, associated_clock)
File "C:\Python312\Lib\site-packages\pyrate_limiter\abstracts\bucket.py", line 134, in register
try_leak = bucket.leak(0)
^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pyrate_limiter\buckets\sqlite_bucket.py", line 118, in leak
count = self.conn.execute(query).fetchone()[0]
^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: openweathermap_bucket
Can you try using an existing db located somewhere you can easily inspect, check for the table existence before running any bucket-creating code? Technically table should be created right after you init the Bucket.
I can check after work, give me a few hours please.
On Mon, Aug 12, 2024 at 12:27 PM Vu Tran @.***> wrote:
I apologize for the late response, I just updated and am still getting the same error:
File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 80, in init self.bucket_factory = self._init_bucket_factory(argument, clock=clock) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 119, in _init_bucket_factory argument = SingleBucketFactory(argument, clock) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\pyrate_limiter\limiter.py", line 43, in init self.schedule_leak(bucket, clock) File "C:\Python312\Lib\site-packages\pyrate_limiter\abstracts\bucket.py", line 263, in schedule_leak self._leaker.register(new_bucket, associated_clock) File "C:\Python312\Lib\site-packages\pyrate_limiter\abstracts\bucket.py", line 134, in register try_leak = bucket.leak(0) ^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\pyrate_limiter\buckets\sqlite_bucket.py", line 118, in leak count = self.conn.execute(query).fetchone()[0] ^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: no such table: openweathermap_bucket
Can you try using an existing db located somewhere you can easily inspect, check for the table existence before running any bucket-creating code? Technically table should be created right after you init the Bucket.
— Reply to this email directly, view it on GitHub https://github.com/vutran1710/PyrateLimiter/issues/169#issuecomment-2284447192, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUHM3YGTPJEY34V7HH5QQTZRDO6XAVCNFSM6AAAAABGNSUQEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBUGQ2DOMJZGI . You are receiving this because you were mentioned.Message ID: @.***>
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:The table
pyrate_table
does not exist and the job fails with:Seems like there are a couple of possible action items:
SQLiteBucket
initialization observe whether the table_name exists, and create if not