There is an issue when using the lancedb and using your own connection. The error is this:
File "/usr/local/lib/python3.12/site-packages/lancedb/db.py", line 467, in __init__
uri = uri.expanduser().absolute()
To resolve, you should change this line to this:
self.connection = connection if connection is not None else lancedb.connect(uri=self.uri, api_key=api_key)