1# SQLite - [Docs ↗](https://docs.val.town/std/sqlite)
2
3[SQLite](https://www.sqlite.org/) is a lightweight, standard database. Every Val Town account comes with its own private SQLite database that is accessible from any of your vals via [`std/sqlite`](https://www.val.town/v/std/sqlite).
4
5Val Town SQLite is powered by [Turso](https://turso.tech/).
9* [ORMs](https://docs.val.town/std/sqlite/orms)
10
11We recommend these admin data viewers for managing your database – viewing or editing data or your database table schema:
12
13* [Outerbase Studio](https://libsqlstudio.com/) **(recommended)** - formely known as LibSQL Studio – see instructions [here](https://libsqlstudio.com/docs/connect-valtown)
17 );
18 return {
19 message: `Added ${results.length} rows to the database.`,
20 results,
21 };
2import { email } from "https://esm.town/v/std/email?v=9";
3import process from "node:process";
4import { notionGetDatabaseEditedAfter } from "https://esm.town/v/stevekrouse/notionGetDatabaseEditedAfter";
5
6export let notionDateMeDocNotify3 = async ({ lastRunAt }: Interval) => {
7 let newDocs = await notionGetDatabaseEditedAfter({
8 auth: process.env.notion,
9 databaseId: "725cb1d741674413b933a37a50f1961f",
10 date: lastRunAt,
11 });
1export const getAllNotionDbRows = async (databaseId, notionAccessToken) => {
2 if (!databaseId) {
3 console.error("No Database ID Provided");
4 return null;
5 }
12 return await axios({
13 method: "POST",
14 url: `https://api.notion.com/v1/databases/${databaseId}/query`,
15 headers: {
16 Authorization: `Bearer ${notionAccessToken}`,
33 // is fully updated *before* I release the lock. If I were to update the state
34 // directly in this val, `@stevekrouse.updateThreadsafeStateEx = `, those
35 // changes wouldn't be saved in the database until *after* I released the lock
36 let newState = state + 1;
37 await runVal("stevekrouse.updateThreadsafeStateEx", {
1import { getDateMeDatabase } from "https://esm.town/v/stevekrouse/getDateMeDatabase";
2import { truncateVal } from "https://esm.town/v/stevekrouse/truncateVal";
3
4export const notionDateDocTruncated = truncateVal(
5 getDateMeDatabase(),
6);
1import process from "node:process";
2import { notionGetDatabase } from "https://esm.town/v/stevekrouse/notionGetDatabase";
3
4export const notionGetDatabaseEditedAfter = async ({ databaseId, auth, date }) => {
5 return notionGetDatabase({
6 auth: process.env.notion,
7 databaseId,
8 filter: {
9 timestamp: "last_edited_time",
1// set by stevekrouse.untitled_NwQdD9zC at 2023-06-08T18:07:45.650Z
2export let databaseVal = [{
3 "hello": "world"
4}];
2import { msAgo } from "https://esm.town/v/rodrigotello/msAgo?v=2";
3import process from "node:process";
4import { notionGetDatabaseEditedAfter } from "https://esm.town/v/stevekrouse/notionGetDatabaseEditedAfter";
5
6export const untitled_TeCzFPJC = notionGetDatabaseEditedAfter({
7 auth: process.env.notion,
8 databaseId: "725cb1d741674413b933a37a50f1961f",
9 date: msAgo(2 * msDay),
10});
51 });
52 // Step 2: Create comment on Lemmy
53 // Step 3: Update Database
54 spacexLemmyDb.commentMap[commentId] = {
55 lemmyId: ret.comment_view.comment.id,