Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.prism.log
.stdy.log
.venv
temp/
regress/
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.2.0"
".": "0.2.1"
}
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## 0.2.1 (2026-04-18)

Full Changelog: [v0.2.0...v0.2.1](https://github.com/stainless-commons/stripe-sql/compare/v0.2.0...v0.2.1)

### Chores

* **internal:** support env vars in `./scripts/repl` ([e61819d](https://github.com/stainless-commons/stripe-sql/commit/e61819df63d91bf0f6b10ecc2abf8730b390d401))
* **internal:** update gitignore ([69bef31](https://github.com/stainless-commons/stripe-sql/commit/69bef3126b1bd07a04bc674559262920b03c29ec))
* **internal:** update multipart form array serialization ([f710526](https://github.com/stainless-commons/stripe-sql/commit/f7105265acdf5b566798f3fcf58528f1bb95b192))
* **tests:** bump steady to v0.19.4 ([0037da0](https://github.com/stainless-commons/stripe-sql/commit/0037da0bb51eace12f3df31216ee2cab695b7b9a))
* **tests:** bump steady to v0.19.5 ([34e63fb](https://github.com/stainless-commons/stripe-sql/commit/34e63fb004f010e4fed95b3f8b357c4236d0d9e0))
* **tests:** bump steady to v0.19.6 ([01d5cde](https://github.com/stainless-commons/stripe-sql/commit/01d5cdebb2577d2bd3716a53aae26654a6881e65))
* **tests:** bump steady to v0.19.7 ([77881f1](https://github.com/stainless-commons/stripe-sql/commit/77881f17bf5ec4d3aae93842e35522b1626b3153))
* **tests:** bump steady to v0.20.1 ([caecce0](https://github.com/stainless-commons/stripe-sql/commit/caecce006ec4da82fe07d4007e7033ed5d7f0b34))
* **tests:** bump steady to v0.20.2 ([65b284f](https://github.com/stainless-commons/stripe-sql/commit/65b284f35ffae8cb04abdee3ee2a0161882923cc))
* **tests:** bump steady to v0.22.1 ([ef16d9b](https://github.com/stainless-commons/stripe-sql/commit/ef16d9b6411f06e7f424938ceaab2174a3077ae9))


### Documentation

* explain caching ([c9ad730](https://github.com/stainless-commons/stripe-sql/commit/c9ad7300a4a279955f8fc2ef1f4cf8b7a3d45c39))

## 0.2.0 (2026-03-17)

Full Changelog: [v0.1.1...v0.2.0](https://github.com/stainless-commons/stripe-sql/compare/v0.1.1...v0.2.0)
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,23 @@ 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 Stripe 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 stripe_coupons AS
SELECT *
FROM stripe_coupons.list();

-- Refresh the view every 4 hours.
SELECT cron.schedule(
'refresh-stripe-coupons',
'0 */4 * * *',
'REFRESH MATERIALIZED VIEW CONCURRENTLY stripe_coupons'
);
```

## Troubleshooting

### Installation
Expand Down
6 changes: 3 additions & 3 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}"
# Run steady mock on the given spec
if [ "$1" == "--daemon" ]; then
# Pre-install the package so the download doesn't eat into the startup timeout
npm exec --package=@stdy/cli@0.19.3 -- steady --version
npm exec --package=@stdy/cli@0.22.1 -- steady --version

npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log &
npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=brackets --validator-form-array-format=brackets --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log &

# Wait for server to come online via health endpoint (max 30s)
echo -n "Waiting for server"
Expand All @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then

echo
else
npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=brackets --validator-query-object-format=brackets "$URL"
npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=brackets --validator-form-array-format=brackets --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL"
fi
13 changes: 10 additions & 3 deletions scripts/repl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,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 +61,17 @@ done
echo "==> Running setup.sql"
psql -d postgres -f test/sql/create_extension.sql

if [ -n "$STRIPE_SECRET_KEY" ]; then
psql -d postgres --variable "value='$STRIPE_SECRET_KEY'" -c 'ALTER DATABASE postgres SET stripe.secret_key = :value;'
fi
if [ -n "$STRIPE_BASE_URL" ]; then
psql -d postgres --variable "value='$STRIPE_BASE_URL'" -c 'ALTER DATABASE postgres SET stripe.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 scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ elif ! steady_is_running ; then
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the steady command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.3 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=brackets --validator-query-object-format=brackets${NC}"
echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=brackets --validator-form-array-format=brackets --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}"
echo

exit 1
Expand Down
Loading