tortoise / tortoise/tortoise-orm

Query params ignored

Open
#760 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
516
Avg merge
2d 21h
Merged PRs (30d)
9

Description

Describe the bug
When passing credentials over query parameters they are just ignored on tortoise

To Reproduce
Use a connection string like:

postgres://host:port/database?user=user&password=password&ssl=require

Expected behavior
Pass to asyncpg the connection credentials

Additional context
The problem seems to be on the tortoise/backends/base/config_generator.py on the expand_db_url method.
All query params are captured and then replace by None or the URL configuration which does not contain the username since it is on the query parameters

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in tortoise/backends/base/config_generator.py at the expand_db_url method and reproduce the issue with the PostgreSQL connection string shown. Trace how query parameters are merged into the URL configuration; done means username, password, and ssl query parameters are passed to asyncpg instead of being discarded.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
backend, database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.