mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 16:18:01 +00:00
Add Open Heroku Database In Postico From Terminal as a Postgres til
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||
|
||||
_1186 TILs and counting..._
|
||||
_1187 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -616,6 +616,7 @@ _1186 TILs and counting..._
|
||||
- [List Various Kinds Of Objects](postgres/list-various-kinds-of-objects.md)
|
||||
- [Lower Is Faster Than ilike](postgres/lower-is-faster-than-ilike.md)
|
||||
- [Max Identifier Length Is 63 Bytes](postgres/max-identifier-length-is-63-bytes.md)
|
||||
- [Open Heroku Database In Postico From Terminal](postgres/open-heroku-database-in-postico-from-terminal.md)
|
||||
- [pg Prefix Is Reserved For System Schemas](postgres/pg-prefix-is-reserved-for-system-schemas.md)
|
||||
- [Prepare, Execute, And Deallocate Statements](postgres/prepare-execute-and-deallocate-statements.md)
|
||||
- [Pretty Print Data Sizes](postgres/pretty-print-data-sizes.md)
|
||||
|
||||
23
postgres/open-heroku-database-in-postico-from-terminal.md
Normal file
23
postgres/open-heroku-database-in-postico-from-terminal.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Open Heroku Database In Postico From Terminal
|
||||
|
||||
I recently downloaded [Postico](https://eggerapps.at/postico/) at the
|
||||
recommendation of [Dillon Hafer](https://dillonhafer.com/). I tend to use
|
||||
`psql` as a PostgreSQL client for all my database querying needs. However,
|
||||
Dillon highly recommended Postico for doing system admin querying.
|
||||
|
||||
I needed to connect directly to a production Postgres server on Heroku to
|
||||
investigate slow queries. Postico presented me with a form of individual fields
|
||||
for host, port, username, password, database, etc.
|
||||
|
||||
This would have been a little annoying to fill in manually. Dillon had a
|
||||
shortcut to recommend. From the command line you can open Postico with a
|
||||
connection string. It knows how to split that connection string into the
|
||||
respective fields.
|
||||
|
||||
```bash
|
||||
heroku config:get DATABASE_URL --app APP_NAME | xargs open -a Postico
|
||||
```
|
||||
|
||||
This requests the `DATABASE_URL` from Heroku. It is a Postgres connection
|
||||
string with all the fields needed to connect to a remove server. This is then
|
||||
passed via `xargs` to `Postico` as it is being `open`ed.
|
||||
Reference in New Issue
Block a user