Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0"
".": "0.1.1"
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.1.1 (2026-03-18)

Full Changelog: [v0.1.0...v0.1.1](https://github.com/beeper/desktop-api-sql/compare/v0.1.0...v0.1.1)

### Chores

* **internal:** codegen related update ([91994fa](https://github.com/beeper/desktop-api-sql/commit/91994fa8b9e406c674d5245f2da123608e87046b))
* **internal:** support env vars in `./scripts/repl` ([9183ad1](https://github.com/beeper/desktop-api-sql/commit/9183ad1d77206204a8650471616d1f97b817f024))
* **internal:** tweak CI branches ([2db5518](https://github.com/beeper/desktop-api-sql/commit/2db5518d6ac525ccd1d753e271f6adcde42398bf))


### Documentation

* explain caching ([d84f8a5](https://github.com/beeper/desktop-api-sql/commit/d84f8a50545721a86b7ea48a8af34bd588961c54))

## 0.1.0 (2026-03-13)

Full Changelog: [v0.0.1...v0.1.0](https://github.com/beeper/desktop-api-sql/compare/v0.0.1...v0.1.0)
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,27 @@ LIMIT 200;
> removed, then PostgreSQL may not [push down the condition](https://wiki.postgresql.org/wiki/Inlining_of_SQL_functions),
> causing all pages to be requested and buffered.

## Caching

Sending requests to the Beeper Desktop API for every SQL query can be slow. Combine [materialized views](https://www.postgresql.org/docs/current/rules-materializedviews.html) with [`pg_cron`](https://github.com/citusdata/pg_cron) for scheduled data pulls:

```sql
CREATE MATERIALIZED VIEW beeper_desktop_api_messages AS
SELECT *
FROM beeper_desktop_api_messages.search(
account_ids := ARRAY['local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI'],
"limit" := 10,
query := 'deployment'
);

-- Refresh the view every 4 hours.
SELECT cron.schedule(
'refresh-beeper-desktop-api-messages',
'0 */4 * * *',
'REFRESH MATERIALIZED VIEW CONCURRENTLY beeper_desktop_api_messages'
);
```

## Troubleshooting

### Installation
Expand Down
16 changes: 13 additions & 3 deletions scripts/repl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

if [ -z "$BEEPER_ACCESS_TOKEN" ]; then
echo 'ERROR: BEEPER_ACCESS_TOKEN environment variable is required but not set'
exit 1
fi

echo "==> Detecting PostgreSQL Python executable"
PYTHON_EXECUTABLE_PATH=$(pg_config --configure | grep -o "PYTHON=[^ ]*" | cut -d= -f2 | tr -d "'")
echo "PostgreSQL uses Python $PYTHON_EXECUTABLE_PATH"
Expand Down Expand Up @@ -29,8 +34,8 @@ if [ "$PG_MAJOR_VERSION" -ge 18 ]; then
done
POSTGRES_CONFIG=(-c extension_control_path="$(realpath temp/install/share/postgresql)")
else
# In PostgreSQL <18 we cannot point `postgres` to our local extensions directory. So we install directly to
# the system.
# In PostgreSQL <18 we cannot point `postgres` to our local extensions directory. So we install
# directly to the system.
sudo make install PG_CONFIG="$(command -v pg_config)"
fi

Expand Down Expand Up @@ -61,10 +66,15 @@ done
echo "==> Running setup.sql"
psql -d postgres -f test/sql/create_extension.sql

psql -d postgres --variable "value='$BEEPER_ACCESS_TOKEN'" -c 'ALTER DATABASE postgres SET beeper_desktop_api.beeper_access_token = :value;'
if [ -n "$BEEPER_DESKTOP_BASE_URL" ]; then
psql -d postgres --variable "value='$BEEPER_DESKTOP_BASE_URL'" -c 'ALTER DATABASE postgres SET beeper_desktop_api.base_url = :value;'
fi

if command -v pgcli &>/dev/null; then
echo "==> Starting pgcli REPL"
pgcli postgres
else
echo "==> Starting psql REPL (TIP: Install pgcli for better autocomplete!)"
psql -d postgres
fi
fi
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading