-
Notifications
You must be signed in to change notification settings - Fork 972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SQLite for custom data layer #832
Conversation
Hi @tjroamer |
With the current chainlit data layer, user-specific sqlite database might not be straightforward to implement. One solution I can think of is that you create views for different users, and select only rows that relevant to that user. This would require some post-processing steps once you have the database as a single file. |
@tjroamer |
Will these users use the same chatbot based on the same server? If this is the case, you cannot send custom database url for each user, since the database url is a server-side setting, and it is done only once when the server starts. |
okay let me figure another way for that. |
@tjroamer But I am not sure how I can put data in that tables for specific user. |
- hide the protocol sqlite+aiosqlite:/// under the hood - user can use relative or absolute file path as input
Any Idea on when this will be merged? |
I'm working on a new version of SQLAlchemyDataLayer so that it can support SQLite and other dialects. Will share it once I've done testing. |
I just went quite deep into the existing SQLAlchemy layer as part of #1319, added tests and make it work with SQLite. I then read the code in this PR and realised I wished it wasn't called SQLite; I don't think we need an SQLite-specific layer, we can suffice with using SQLAlchemy, but the code in this PR (and possibly what's lying in @qtangs's attic) has a lot of good stuff I'd love to merge. All of this towards a much needed cleanup on the roadmap to moving all non-literalai (after all, it's the core product!) data layers into a separate community-maintained repo. I'd invite you all to have a look at #1319 and am also inviting you to share ideas on a community repo and how we could best pull that off (I'm thinking to invite 2/3 community members and setup a monorepo, with data layers first - but only after having test coverage for data layers). |
#1319 has just been merged, we now have test coverage for SQLAlchemy/SQLite. Looking forward to integrate the goodies from here! @tjroamer Feel like giving this a try? Note that you've shot this PR from your own main branch, might want to continue working in a feature branch (e.g. with a different name). |
@dokterbob you're spot on. I've been building on top of the code here while integrating with SQLAlchemy. It has taken a while to rewrite everything and to test properly. Thanks for the reminder here. |
Closing in favour of #1365. |
Overview
How to configure
Test
A simple sanity check is implemented in
cypress/e2e/data_layer_sqlite
, which is a simplified copy ofcypress/e2e/data_layer
.Limitation
no file blob support, so chat history will not show attachments