Git Product home page Git Product logo

Comments (15)

DallasHoff avatar DallasHoff commented on August 16, 2024 9

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.

DallasHoff avatar DallasHoff commented on August 16, 2024 4

@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.

AntonOfTheWoods avatar AntonOfTheWoods commented on August 16, 2024 4

@AndriiSherman Just out of curiosity, was this deprioritised due to it being more complicated than expected or lack of interest?

from drizzle-orm.

jordanhboxer avatar jordanhboxer commented on August 16, 2024 2

Hi @AndriiSherman ā€“ any update on this? I can try to help if you need

from drizzle-orm.

ShravanSunder avatar ShravanSunder commented on August 16, 2024 1

@AndriiSherman Would it be possible to know how this is going?

from drizzle-orm.

AntonOfTheWoods avatar AntonOfTheWoods commented on August 16, 2024 1

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.

Azarattum avatar Azarattum commented on August 16, 2024

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.

AndriiSherman avatar AndriiSherman commented on August 16, 2024

@Azarattum yes, we were looking into using official SQLite wasm

from drizzle-orm.

ShravanSunder avatar ShravanSunder commented on August 16, 2024

@DallasHoff do you have feature list for drizzle that your lib covers? Nice work, and nice docs too!

from drizzle-orm.

DallasHoff avatar DallasHoff commented on August 16, 2024

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.

sjunepark avatar sjunepark commented on August 16, 2024

@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.

Sheraff avatar Sheraff commented on August 16, 2024

@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, like db.all(sql`SELECT * FROM foo`))?
  • is there an "official" way to handle prepared query finalization? Both cr-sqlite and wa-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.

DallasHoff avatar DallasHoff commented on August 16, 2024

@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 avatar AntonOfTheWoods commented on August 16, 2024

@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.

zackify avatar zackify commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.