Skip to content

Commit

Permalink
Use engine.connect
Browse files Browse the repository at this point in the history
  • Loading branch information
ddxv committed Oct 3, 2024
1 parent ff3919d commit ec14626
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion adscrawler/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, db_name: str, db_ip: str, db_port: str) -> None:
self.db_name = db_name
self.db_ip = db_ip
self.db_port = db_port
self.engine: Engine | None = None
self.engine: Engine

try:
self.db_pass = CONFIG[self.db_name]["db_password"]
Expand Down
6 changes: 3 additions & 3 deletions adscrawler/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ def query_pub_domains(
def delete_app_url_mapping(app_url_id: int, database_connection: PostgresCon) -> None:
del_query = text("DELETE FROM app_urls_map WHERE id = :app_url_id")
logger.info(f"{app_url_id=} delete app_urls_map start")
raw_conn = database_connection.engine.raw_connection()
with raw_conn.cursor() as cur:
cur.execute(del_query, {"app_url_id": app_url_id})

with database_connection.engine.connect() as conn:
conn.execute(del_query, {"app_url_id": app_url_id})
conn.commit()


def query_store_apps(
Expand Down

0 comments on commit ec14626

Please sign in to comment.