R
Railway15mo ago
rbravo

How to connect FastAPI with Planetscale (mysqlclient error)

Hey, how are you guys doing? I have a backend on Railway who is running with FastAPI (using this template https://railway.app/template/-NvLj4). I'm also using planetscale, which requires me to have mysqlclient as a dependency. The problem is that when the app is building I'm getting the error attached. Does anyone know how can I fix this?
8 Replies
Percy
Percy15mo ago
Project ID: 2cec54f7-d04f-4c70-8360-d4c48cf0e9b6
rbravo
rbravoOP15mo ago
2cec54f7-d04f-4c70-8360-d4c48cf0e9b6
rbravo
rbravoOP15mo ago
Maybe we need a PR like this https://github.com/railwayapp/nixpacks/pull/496 for FastAPI?
GitHub
python provider: support mysql backends for django by char8 · Pull ...
Fixes #483 and Fixes #488 by providing the dependency required by the mysqlclient python package. Tested building the example linked in #488 (🙏 ) locally and running the resulting container against...
Brody
Brody15mo ago
you can always try to install that package yourself, add this as a nixpacks.toml to your project
[phases.setup]
aptPkgs = ['...', 'libmysqlclient-dev']
[phases.setup]
aptPkgs = ['...', 'libmysqlclient-dev']
rbravo
rbravoOP15mo ago
Hey, @Brody, thank you for the help! It looks like the error it's a bit different now:
rbravo
rbravoOP15mo ago
rbravo
rbravoOP15mo ago
Here's how I added what you told:
No description
Brody
Brody15mo ago
the missing mysql_com.h is said to be included in libmysqlclient-dev truthfully the mysql dependency with python has always been a mystery, with the solution being, use postgres or use some other pre-built mysql python package let me see if I can find that package https://discord.com/channels/713503345364697088/1133956338867773470/1134336721711009822
Want results from more Discord servers?
Add your server