Comments (8)
I have multiple databases with hyphens in the name and the other ones work fine. So it's probably the hyphen in the table name.
from d1-manager.
I am not sure...
Is there any special character in the table name or column name? I may have forgotten to escape something...
from d1-manager.
The database is called prod-logs
, the table logs-v1
.
Here's the schema:
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
export const logsTableV1 = sqliteTable("logs-v1", {
id: integer("id", { mode: "number" }).primaryKey({ autoIncrement: true }),
// Timestamp
timestamp: integer("timestamp", { mode: "number" }).notNull(),
// Request details
method: text("method").notNull(),
url: text("url").notNull(),
statusCode: integer("statusCode").notNull(),
duration: integer("duration").notNull(),
// Location details
ip: text("ip").notNull(),
country: text("country"),
regionCode: text("regionCode"),
city: text("city"),
// Service details
microservice: text("microservice").notNull(),
deployment: text("deployment").notNull(),
environment: text("environment").notNull(),
// User details
customerSessionId: text("customerSessionId"),
userId: text("userId"),
superadminId: text("superadminId"),
// Additional data
data: text("data"),
// Error details
error: text("error"),
});
Maybe timestamp
is a problem?
from d1-manager.
I'm guessing it's the hyphen in the database name
from d1-manager.
https://stackoverflow.com/a/3694305/311220
A table name with a hyphen would need to be quoted.
Definitely some places where it looks like that's not happening:
https://github.com/search?q=repo:JacobLinCool/d1-manager+prepare+table&type=code
from d1-manager.
Hi @JacobLinCool
Thank you for this great tool,
It seems that Cloudflare takes the table name directly from the URL param without adding anything to it.
By simply adding single quotes to the table name in the URL it will solve the issue e.g. /api/db/demodb/'table-name'/data?...
I have also tested the case with database names with hyphen and it seems that Cloudflare accept using hyphens in database names, but unlike table names it is processed from Cloudflare side and quoting the database name in URLs isn't necessary.
I have also tested columns and it has the same issue as with table names, I will make a PR with suggested fix for both table and column names.
from d1-manager.
Hello @moalamri
Thank you for your observations and contributions on PR #53.
I want to clarify that the /api/... endpoints are not part of the Cloudflare API; they are located here.
Since the database name is not presented in the SQL statement, it seems I forgot to escape the table name in the following places:
Maybe your utility functions should be applied to those places instead of replacing them in the URL at the frontend side. (It seems strange to see quotes in an URL)
from d1-manager.
Hey @JacobLinCool
My bad :) I looked into the component and really assumed they were calling Cloudflare.
I will work on it soon, maybe simplify it more by always applying escape to identifiers since they can accept a lot of special characters.
from d1-manager.
Related Issues (14)
- D1_ERROR: not authorized HOT 7
- Dependency Dashboard
- `Cloudflare Pages`: Your Functions script is over the 1 MiB size limit HOT 2
- no tables populated in DB HOT 4
- Show query row counts
- Deployment details HOT 1
- Try sqlcoder-7b-2
- Split long CSV imports into multiple smaller queries HOT 2
- Could you please give more detail about deployment? HOT 1
- Support CSV Import and Export
- access control pages plugin middleware
- how do i protect this from public access HOT 1
- Save query result as a http service [Feature Request] HOT 2
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 d1-manager.