isaac-mcfadyen / d1-console Goto Github PK
View Code? Open in Web Editor NEWA full query console for Cloudflare's D1 database product.
License: GNU General Public License v3.0
A full query console for Cloudflare's D1 database product.
License: GNU General Public License v3.0
Would be great to also be able to access local databases when using Wrangler.
Wrangler stores its local SQLite database at sqlite3 .wrangler/state/v3/d1/miniflare-D1DatabaseObject/ab43d37f48135ef454cdb4895268c4c8817c5f76a0ae8db115f478b15ca263a5.sqlite
.
When starting d1-console
with --local
or -l
, it should connect to the local database instead (no need for API keys). Most of the implementation would be in queryDatabase
or queryDatabaseApi
), where instead of fetch you would access the local SQLite database using https://www.npmjs.com/package/better-sqlite3
Heya,
I would like to query D1 and get the json output in a shell stream.
For the following query I can't seem to get only the JSON data (without the Welcome to D1 Console!
) and other info lines.
d1-console query -d example --execute 'SELECT * FROM sqlite_master;' --json
D1 Console v1.4.4
Welcome to D1 Console!
Enter a query followed by a semicolon to run it on the database. Multiple queries seperated by a semicolon will be run as a transaction (batch).
For more information, enter HELP;
Now querying database example (b0855cca-e921-4c9b-bff5-4f944581094d)
[
{
"type": "table",
"name": "d1_kv",
"tbl_name": "d1_kv",
"rootpage": 2,
"sql": "CREATE TABLE d1_kv (key TEXT PRIMARY KEY, value TEXT NOT NULL)"
},
{
"type": "index",
"name": "sqlite_autoindex_d1_kv_1",
"tbl_name": "d1_kv",
"rootpage": 3,
"sql": null
}
]
I tried adding 2>/dev/null
to the command in order to send stderr
to the bit bin, unfortunately that doesn't work ๐ข
Some suggestions:
-silent
mode as per spatialite
stderr
instead of stdout
spatialite --help |& grep silent
-silent suppress the welcome message
Would be nice to list tables similar to .tables
with SQLite
Hi! First, love d1-console :) I could barely use D1 without it!
It'd be cool if there was a command to re-auth, like d1-console login
- I accidently entered the wrong account ID and had to find where it was storing the creds to fix it ($HOME/.d1
).
Along with this, d1-console whoami
might be helpful, to see what I'm logged in as (I have multiple CF accounts.)
Thanks!
Hi can you please help me understand what all permissions are needed while creating the API key for d1-console?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.