1# VALL-E
23LLM code generation for vals! Make apps with a frontend, backend, and database.
45It's a bit of work to get this running, but it's worth it.
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
sqlite_adminREADME.md1 match
7It's currently super limited (no pagination, editing data, data-type specific viewers), and is just a couple dozens lines of code over a couple different vals. Forks encouraged! Just comment on the val if you add any features that you want to share.
89To use it on your own Val Town SQLite database, [fork it](https://www.val.town/v/stevekrouse/sqlite_admin/fork) to your account.
1011It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
1# Uptime Checker & Status Page
23This is a free, hackable uptime/downtime monitor that sends you an email when the site doesn't return a 200. It also stores historical uptime and latency data in your Val Town SQLite, which is used to power a status page. It supports multiple URLs in the same database and status page.
45## Installation
getValsContextWindowmain.tsx1 match
116{
117name: "Use Val Town SQLite to store data",
118prompt: "Write a val that uses an SQLite database",
119code: `import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
120
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
databaseRunnermain.tsx20 matches
6import pg from "npm:pg";
78type DatabaseType = "postgres" | "mysql" | "duckdb";
910interface QueryRequest {
11databaseType: DatabaseType;
12url?: string;
13query?: string;
33}
3435const { databaseType, url, query, introspect, gzip = false } = requestBody;
36console.log(`Database type: ${databaseType}`);
37console.log(`Query: ${query}`);
38console.log(`Introspect: ${introspect}`);
39console.log(`Gzip: ${gzip}`);
4041if (!databaseType) {
42console.error("Missing database type");
43return new Response("databaseType is required", { status: 400 });
44}
4549}
5051if (databaseType !== "duckdb" && !url) {
52console.error("Missing URL for non-DuckDB query");
53return new Response("URL is required for postgres and mysql", { status: 400 });
57try {
58if (introspect) {
59console.log(`Introspecting ${databaseType} schema`);
60if (databaseType === "postgres") {
61results = await introspectPostgresSchema(url!);
62} else if (databaseType === "mysql") {
63results = await introspectMysqlSchema(url!);
64} else {
65console.error(`Introspection not supported for ${databaseType}`);
66return new Response(`Introspection not supported for ${databaseType}`, { status: 400 });
67}
68} else {
69console.log(`Executing ${databaseType} query`);
70if (databaseType === "postgres") {
71results = await executePostgresQuery(url!, query!);
72} else if (databaseType === "mysql") {
73results = await executeMysqlQuery(url!, query!);
74} else if (databaseType === "duckdb") {
75console.log("DuckDB is not supported");
76return new Response("DuckDB is not supported", { status: 400 });
77} else {
78console.error(`Invalid database type: ${databaseType}`);
79return new Response("Invalid databaseType", { status: 400 });
80}
81}
118if (error.code === "ETIMEDOUT") {
119throw new Error(
120"Connection to PostgreSQL timed out. Please check your database URL and ensure the database is accessible.",
121);
122}
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable