Skip to content

Commit 4b55c04

Browse files
authored
Exporting Amplitude events to SQLite
1 parent 11109c5 commit 4b55c04

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Exporting Amplitude events to SQLite
2+
3+
[Amplitude](https://amplitude.com/) offers an "Export Data" button in the project settings page. This can export up to 365 days of events (up to 4GB per export), where the export is a zip file containing `*.json.gz` gzipped newline-delimited JSON.
4+
5+
You can export multiple times, so if you have more than a year of events you can export them by specifying different date ranges. It's OK to overlap these ranges as each event has a uniue `uuid` that can be used to de-duplicate them.
6+
7+
Here's how to import that into a SQLite database using `sqlite-utils`:
8+
```
9+
unzip export # The exported file does not have a .zip extension for some reason
10+
cd DIRECTORY_CREATED_FROM_EXPORT
11+
gzcat *.json.gz | sqlite-utils insert amplitude.db events --nl --alter --pk uuid --ignore -
12+
```
13+
Since we are using `--pk uuid` and `--ignore` it's safe to run this against as many exported `*.json.gz` files as you like, including exports that overlap each other.
14+
15+
Then run `datasette amplitude.db` to browse the results.

0 commit comments

Comments
 (0)