(value: str)
| 53 | |
| 54 | |
| 55 | def normalize_postgres_url(value: str) -> str: |
| 56 | raw = str(value or "").strip() |
| 57 | if not raw: |
| 58 | raise MigrationError("PostgreSQL 目标库 URL 不能为空") |
| 59 | if raw.startswith("postgres://"): |
| 60 | raw = "postgresql://" + raw[len("postgres://"):] |
| 61 | if get_database_backend(raw) != "postgresql": |
| 62 | raise MigrationError("目标库必须是 PostgreSQL 连接字符串") |
| 63 | if raw.startswith("postgresql://"): |
| 64 | return "postgresql+psycopg://" + raw[len("postgresql://"):] |
| 65 | return raw |
| 66 | |
| 67 | |
| 68 | def chunked_rows(rows: Sequence[dict], chunk_size: int) -> Iterator[list[dict]]: |
no test coverage detected