Hey guys, I am using your self-hosted API on my lo...
# help
Hey guys, I am using your self-hosted API on my local machine. I was successful with loading the data and the GraphQL Playground shows results for my queries. But I am not quite sure how I could access the database with python for example. There are 2 docker containers running: cloud-pricing-api-api-1 (>4000/tcp) and cloud-pricing-api-postgres-1 (5432/tcp). I unsuccessfully tried to connect with the python postgres library psycopg2. Is that possible? I am not quite sure to which container to connect and with which parameters. Sadly, try and error resulted only in error ;-) Edit: And any tipps are much appreciated! If someone used a different library that code would also help me of course. For psycopg2 you need to specify: database="cloud-pricing", (also tried cloud-pricing-api-postgres-1) user="postgres", password="postgres", host="", port="4000" (but also tried 5432) Thank you so much for your awesome work
Hi @hundreds-activity-29799. If you’re running docker-compose to launch the database, you will probably need to update the
file to expose the postgresql port. You can do this by adding something like:
Copy code
    - 5444:5432
To the
service in that file. That will mean the DB is now available on port 5444 from your local host. Once that’s done you should be able to connect to it with the following settings:
Copy code
host: localhost
port: 5444
user: postgres
password: postgres
database: cloud_pricing
Of Course! Thank you so much. Is there a way to send you some coffee-money?
No problem. Thanks 🙏! We don't take any sponsorship, but appreciate any opportunity you have to spread the word about infracost.