postgresql

MMilanK5/23/2023
What changes do I need to make in the fastapi demo app to be able to access a postgresql? Both are from Railway templates and running in the production environment. I'm novice to all this.
MMilanK5/23/2023
3ffb43c3-27a4-47ba-b079-79313c5ebe25
Bbrody5/23/2023
add a postgre database plugin to your project
setup the variable references to the database in your service
ust use your postgre python package of your choosing and connect using the environment variables
MMilanK5/23/2023
How do I add a postgre database plugin to a project?
I have created variable references
Sample code how to fetch data from the postgre database?
Bbrody5/23/2023
once you are in the project you click the plus button in the top right
then once the database is added, setup the variable references in your service that will be using the database
https://docs.railway.app/develop/variables#reference-variables
as for sample code, you'll have to read some tutorials
MMilanK5/23/2023
Ah yes I have added the postgresql, do you have a tutorial how to initialize it from requirements.txt and main.py so it can be used in the code? I looked in your doc library but could not find any suitable sample.
Bbrody5/23/2023
that's more of a question you answer by reading or watching tutorials
MMilanK5/23/2023
ok, do you know how I can get professional services to help me out - do you offer a service like this?
Bbrody5/23/2023
these help threads are intended for questions about the platform.
I'm sure there's some great YouTube videos on how to query postgre from python that you could watch!
MMilanK5/23/2023
ok
Bbrody5/23/2023
if you have any questions involving railway or issues with railway, feel free to ask those here
MMilanK5/23/2023
I can't figure out why pip command does not work in my code - it works in my local development:
File "main.py", line 1
pip install mysqlclient
^
MMilanK5/23/2023
@Brody is the syntax different in railway for pip? if so how do I install mysqlclient in the main.py?
Bbrody5/23/2023
#🛂|readme #5
Bbrody5/23/2023
in your original question you ask how to use postgre, but now you are trying to install a mysql package, i can recommend you stick with postgre
MMilanK5/23/2023
Ok I got it to work with postgre by including it in the requirements.txt

But I think there is some issue with MySQL - it did not even work on the Query UI interface when I run Select * from Customers - page crashes and shows "Application error: a client-side exception has occurred (see the browser console for more information)."

Also when I added mysqlclient==2.1.1 to the requirements.txt it also throws build errors.
Bbrody5/23/2023
1. postgre and mysql are two different things.
2. please don't rely on the data tab of the database plugins
MMilanK5/23/2023
1. yes I'm aware, I have worked with both of them previously
2. ok noted
MMilanK5/23/2023
Thanks for your help @Brody
Bbrody5/23/2023
no problem!