(text: str)
| 20 | |
| 21 | |
| 22 | def is_valid_connection_scheme(text: str) -> tuple[bool, str | None]: |
| 23 | # exit early if the text does not resemble a DSN URI |
| 24 | if "://" not in text: |
| 25 | return False, None |
| 26 | scheme = text.split("://")[0] |
| 27 | if scheme.startswith('mysql+'): |
| 28 | return True, None |
| 29 | if scheme.startswith('mysqlx+'): |
| 30 | return True, None |
| 31 | if scheme in ("mysql", "mysqlx", "tcp", "socket"): |
| 32 | return True, None |
| 33 | return False, scheme |