Skip to content

MySQLDsn build failed if password contains special character  #1467

@zh0uquan

Description

@zh0uquan

Hello, running the following code to build mysql url will cause a error when password contains a special character #.

from pydantic import MySQLDsn
MySQLDsn.build(
      scheme="mysql+aiomysql",
      username="test", 
      password="test#1", 
      host="127.0.0.1", 
      port=3306, 
     path="test"
)

this is the error message

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pydantic_core._pydantic_core.ValidationError: 1 validation error for url
  Input should be a valid URL, invalid port number [type=url_parsing, input_value='mysql+aiomysql://test:test#[email protected]:3306/test', input_type=str]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions