fix: set UTF8 client encoding for schema init
Showing
1 changed file
with
3 additions
and
4 deletions
| ... | @@ -19,10 +19,9 @@ def main() -> None: | ... | @@ -19,10 +19,9 @@ def main() -> None: |
| 19 | 19 | ||
| 20 | psycopg = _import_psycopg() | 20 | psycopg = _import_psycopg() |
| 21 | schema_sql = Path(args.schema).read_text(encoding="utf-8") | 21 | schema_sql = Path(args.schema).read_text(encoding="utf-8") |
| 22 | with psycopg.connect(args.dsn) as conn: | 22 | with psycopg.connect(args.dsn, autocommit=True) as conn: |
| 23 | with conn.cursor() as cursor: | 23 | conn.execute("SET client_encoding = 'UTF8'") |
| 24 | cursor.execute(schema_sql) | 24 | conn.execute(schema_sql) |
| 25 | conn.commit() | ||
| 26 | print(f"initialized schema from {args.schema}") | 25 | print(f"initialized schema from {args.schema}") |
| 27 | 26 | ||
| 28 | 27 | ... | ... |
-
Please register or sign in to post a comment