tortoise / tortoise/tortoise-orm
Generating database URLs from its components
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
I'm not sure if this is already feasible, but if it is, it's completely undocumented.
Is your feature request related to a problem? Please describe.
I have a bunch of environment variables such as PGDATABASE, PGUSER, PGPASSWORD etc. I want to generate a database URL using those, without worrying about the format of the URL itself.
Describe the solution you'd like
from tortoise.utils import create_db_url
db_url = create_db_url(
engine="postgres",
dbname=os.getenv("DBNAME", "postgres"),
username=os.getenv("PGUSER", "postgres"),
...
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by checking the tortoise.utils module for existing database URL parsing or construction utilities, then inspect related tests if present. Confirm how the requested engine, database name, username, password, host, and port inputs should be represented, and consider the feature complete when those components reliably produce a valid database URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100