Skip to content

Instantly share code, notes, and snippets.

@javahippie
Created May 19, 2024 10:29
Show Gist options
  • Save javahippie/e0988419f01327545835cd05d2665230 to your computer and use it in GitHub Desktop.
Save javahippie/e0988419f01327545835cd05d2665230 to your computer and use it in GitHub Desktop.
INSTALL json;
LOAD json;
INSTALL sqlite;
LOAD sqlite;
ATTACH 'messages.db' AS sqlite_db (TYPE SQLITE);
CREATE TABLE sqlite_db.messages (name VARCHAR, text VARCHAR, ts VARCHAR, channel VARCHAR);
INSERT INTO sqlite_db.messages (SELECT user_profile.real_name as name,
text,
ts,
regexp_extract(filename, '^slack-export/(.*)/', 1) as channel
FROM read_json_auto('slack-export/**/*.json',
filename = true));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment