22from io import TextIOWrapper
33import os
44import time
5- from typing import Any , AsyncGenerator , Dict , Iterable , List , Optional , TypeVar , Union
5+ from typing import Any , AsyncGenerator , Dict , Iterable , Optional , TypeVar
66
77import asyncpg
88from asyncpg .connection import Connection
@@ -87,7 +87,9 @@ async def run_migration(dsn: Optional[str] = None) -> str:
8787 except asyncpg .exceptions .UndefinedTableError :
8888 oldversion = None
8989 logging .debug (
90- f"Old Version: { oldversion } New Version: { version } Migrations Dir: { migrations_dir } "
90+ f"Old Version: { oldversion } "
91+ f"New Version: { version } "
92+ f"Migrations Dir: { migrations_dir } "
9193 )
9294 if oldversion == version :
9395 logging .debug (f"Target database already at version: { version } " )
@@ -103,7 +105,8 @@ async def run_migration(dsn: Optional[str] = None) -> str:
103105
104106 if not os .path .exists (migration_file ):
105107 raise Exception (
106- f"Pypgstac does not have a migration from { oldversion } to { version } ({ migration_file } )"
108+ "Pypgstac does not have a migration "
109+ f"from { oldversion } to { version } ({ migration_file } )"
107110 )
108111
109112 open_migration_file = open (migration_file )
@@ -186,7 +189,7 @@ async def copy(iter: T, table: tables, conn: asyncpg.Connection) -> None:
186189 )
187190 logger .debug ("Backfilling partitions" )
188191 await conn .execute (
189- f """
192+ """
190193 SELECT backfill_partitions();
191194 """
192195 )
@@ -254,7 +257,7 @@ async def copy_upsert(iter: T, table: tables, conn: asyncpg.Connection) -> None:
254257 logger .debug ("Data Copied" )
255258 if table == "collections" :
256259 await conn .execute (
257- f """
260+ """
258261 INSERT INTO collections (content)
259262 SELECT content FROM pgstactemp
260263 ON CONFLICT (id) DO UPDATE
@@ -265,7 +268,7 @@ async def copy_upsert(iter: T, table: tables, conn: asyncpg.Connection) -> None:
265268 if table == "items" :
266269 logger .debug ("Upserting Data" )
267270 await conn .execute (
268- f """
271+ """
269272 SELECT upsert_item(content)
270273 FROM pgstactemp;
271274 """
0 commit comments