Comments (9)
@ysm-dev we have released support for proxy requests in 0.17.4
.
Here is small code snippet for SQLite Proxy Driver
const db = drizzle(async (sql, params, method) => {
try {
const rows = await axios.post('http://localhost:3000/query', {
sql,
params,
method,
});
return { rows: rows.data };
} catch (e: any) {
console.error('Error from sqlite proxy server: ', e.response.data);
return { rows: [] };
}
});
You can read release notes and also here is a link for full usage example
Using this example you can make any driver on server side to execute raw queries
Fell free to ping me, if something won't work for you
from drizzle-orm.
@ysm-dev hey!
can you please share a raw example of what you're trying to achieve?
we have examples with FlyIO LiteFS, yet they have a fs layer
I'm not sure how that works in Vercel
ps: we've discussed mocked db to use as query builder, we'll implement soon
from drizzle-orm.
@ysm-dev we'll provide you an interface for that one of these days
from drizzle-orm.
@AlexBlokh thank you for quick reply!
I'm trying to build SQL Query inside Vercel Edge Runtime and
send that SQL Statement to Cloudflare Workers (D1) over http.
1 more question:
I'm using SQLite + Cloudflare D1,
and when I insert with undefined
or null
values, it saved as string it self:
is it bug? or feature?
Thank you for great library!
from drizzle-orm.
@ysm-dev so you're sending http request to Cloudflare worker, propagate it to D1 and send D1 response back?
if you can provide us an example project or a code snippet for that - would be very helpful
from drizzle-orm.
@ysm-dev btw if you're using Cloudflare, why would you need Vercel?
from drizzle-orm.
@ysm-dev so you're sending http request to Cloudflare worker, propagate it to D1 and send D1 response back?
if you can provide us an example project or a code snippet for that - would be very helpful
Yea I want to build SQL statements (with drizzle) outside of Cloudflare workers and send the Query
object over HTTP,
// ex) Query object
{
sql: 'select * from user',
params: []
}
and run this Query in Cloudflare Workers with DrizzleORM + D1, and return it.
So Cloudflare Workers is like just SQL Runner.
And wants to use all type-safety outside of Worker.
How can I achieve this?
from drizzle-orm.
@AlexBlokh Thank you!
from drizzle-orm.
@AndriiSherman Thank you for the quick feedback and update!
I tried a Proxy driver with CF D1 Database, but there is no prepare
type in D1 drizzle instance.
from drizzle-orm.
Related Issues (20)
- [BUG]: Missing `index names` when running `introspect` command [MYSQL]
- [BUG]: Postgis `geometry` query select fails when using `with`
- [BUG]: Schema generation with custom schema not working for mysql
- [BUG]: Issues with nested conditions & placeholders in SQLite query
- [BUG]: `drizzle-kit introspect` produces diffs without underlying schema changes
- [BUG]: Cannot rename table with composite primary keys HOT 1
- [FEATURE]: Track constraints in the type system
- [FEATURE]: explicitly mark a models' column definition as NULL with a ".null()" chain function
- [FEATURE]: SQLITE - Introspect `BOOLEAN` as `integer("...", { mode : "boolean" })`
- [BUG]: Drizzle studio wont run with current versions of orm and kit HOT 1
- [FEATURE]: unit of work
- [BUG]: Error: Cannot find native module 'ExpoSQLiteNext' HOT 1
- [BUG]: Missing Documentation `mapResult`
- [FEATURE]: Consistent Section Tab Selection in docs
- [BUG]: TIMESTAMPS showing up incorrectly on drizzle studio. HOT 1
- [BUG]: drizzle-zod: documented usage generates type error with `exactOptionalPropertyTypes`
- [BUG]: INSERT generates null values for omitted columns, violating not-null constraints during UPSERT HOT 1
- [BUG]: Duplicate entry for auto increment column when execute insert statement
- [BUG]: Aggregated results from many-to-one relations doesn't return timestamp using postgres DB
- [BUG]: Cannot read properties of undefined (reading 'type')
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.