Comments (15)
Recently, I've been working on a library to make SQLite WASM easier to use, and I found that making it work as a driver for Drizzle was actually pretty easy. If you need this, I hope it helps you out: https://sqlocal.dallashoffman.com/drizzle/setup
For migrations, I've been looking into making a PR to Drizzle to add a version of their migrate
function that works on the frontend. It should be possible. I'll probably make an issue first just so the Drizzle guys have a chance to say "no thanks" or "we already have this halfway done" first. Hopefully there's interest from them.
from drizzle-orm.
@ShravanSunder Querying and anything else that you do through the main drizzle
function should work. It's just migrations that need work since Drizzle's migrate
function only works in Node.js, but everything else looks to work just fine in the browser. Drizzle handles the schema definition and query building stuff. It passes the raw SQL for the query to SQLocal acting as the driver, and SQLocal takes that, passes it to the SQLite WASM database, and returns any result data back to Drizzle. It's like any other driver except instead of communicating with a remote server running the database, the database is running in a web worker.
from drizzle-orm.
@AndriiSherman Just out of curiosity, was this deprioritised due to it being more complicated than expected or lack of interest?
from drizzle-orm.
Hi @AndriiSherman ā any update on this? I can try to help if you need
from drizzle-orm.
@AndriiSherman Would it be possible to know how this is going?
from drizzle-orm.
There seem to be a lot of interest in generating hype but not much interest in making things useful. "Support" for pglite
has been added, which is still very much proof-of-concept/pre-alpha, which is also a browser-based db but still no examples on how this might actually be useful, given there is no way to make migrations happen.
from drizzle-orm.
Is this for the official SQLite wasm or for something like wa-sqlite (which from my understanding is currently superior to the official build)?
from drizzle-orm.
@Azarattum yes, we were looking into using official SQLite wasm
from drizzle-orm.
@DallasHoff do you have feature list for drizzle that your lib covers? Nice work, and nice docs too!
from drizzle-orm.
For migrations, I've been looking into making a PR to Drizzle to add a version of their
migrate
function that works on the frontend. It should be possible. I'll probably make an issue first just so the Drizzle guys have a chance to say "no thanks" or "we already have this halfway done" first. Hopefully there's interest from them.
Here's that issue for those interested: #1009
from drizzle-orm.
@DallasHoff I had a hard time setting up sqlite wasm, and had no idea I would stumble into such a project here. Will try it out thanks.
from drizzle-orm.
@AndriiSherman I wrote an adapter for crsqlite-wasm
(from Vlcn https://vlcn.io/docs/cr-sqlite/intro). As far as I can tell, this seems to be working. It's heavily inspired from the better-sqlite3
and the libsql
adapters from this very repo.
Here's the published package for it: https://www.npmjs.com/package/drizzle-orm-crsqlite-wasm.
I have a few questions, of which you can answer between none and all (no worries, I know OSS is draining!):
- are there any plans to add support to wasm sqlite builds (crsqlite, wa-sqlite, or other)? I wasn't planning on writing a package and my hope is that it can become deprecated at some point.
- is there any way to bypass creating a
PreparedQuery
when running queries directly on the Session (without a query builder, likedb.all(sql`SELECT * FROM foo`)
)? - is there an "official" way to handle prepared query finalization? Both
cr-sqlite
andwa-sqlite
create "statement" objects on which we need to call.finalize()
at some point to avoid memory leaks. I ended up using the FinalizationRegistry to auto-finalize those queries, but I was curious whether there would be a more "standard" way in drizzle to do that. - does the code look exhaustive? Or am I missing some use-cases that wouldn't work with this adapter but would with any other?
from drizzle-orm.
@AntonOfTheWoods Be sure to give #1009 a thumbs up if you haven't already so that the maintainers know that there is interest.
from drizzle-orm.
@AntonOfTheWoods Be sure to give #1009 a thumbs up if you haven't already so that the maintainers know that there is interest.
@DallasHoff Unless I'm mistaken, none of the maintainers have even bothered to comment on that ticket, which seems to have garnered at least a modicum of interest. Not giving me much confidence in the health of the project ecosystem...
from drizzle-orm.
I saw a maintainer say it was on the roadmap last march, can someone at least respond from the drizzle team?
Iām going to sponsor them in hope of getting this issue looked at
from drizzle-orm.
Related Issues (20)
- [FEATURE]: mysql2 wait_timeout in createConnection
- [BUG]: type obtained with $inferInsert is empty HOT 13
- [BUG]: PostgresError: relation "public.user" does not exist
- [BUG]: Syntax error in generated SQL with generatedAlwaysAs and notNull on MySQL
- [BUG]: error: no pg_hba.conf entry for host
- [FEATURE]: Drizzle Prisma integration with no restrictions (Solution proposal)
- [BUG]: OP SQLite timestamp integer column returns a string initially then a Date
- [BUG]: unexpected DROP SEQUENCE statements on `drizzle-kit push` HOT 1
- [BUG]: there is no unique or exclusion constraint matching the ON CONFLICT specification
- [FEATURE]: Allow sql magic in target in onConfilict
- [FEATURE]: daterange support for postgresql
- [FEATURE]: `node:sqlite` support
- [FEATURE]: Support for ordering/filtering on relations in drizzle `findMany` query method
- useLiveQuery doesn't update if the query parameters change.
- [FEATURE]: Drizzle relations with materialized views HOT 2
- [BUG]: TypeScript error on optional fields during update (and insert) operation HOT 5
- [BUG]: Incorrect inference for PostgreSQL array columns (arrays may contain null items)
- [BUG]: Error when running npx drizzle-kit introspect: "Expected object, received string" HOT 3
- [BUG]: cannot insert many sql variables when using cloudflare d1 HOT 1
- [BUG]: useLiveQuery doesn't see change when querying joined tables
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drizzle-orm.