Skip to content

Commit

Permalink
set cursor itersize when creating cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanWelzel committed Sep 14, 2023
1 parent f48f51b commit 1224d96
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hub/dataload/sources/drugcentral/drugcentral_dump.py
Expand Up @@ -18,6 +18,7 @@ class DrugCentralDumper(BaseDumper):
SRC_ROOT_FOLDER = os.path.join(DATA_ARCHIVE_ROOT, SRC_NAME)

# The number of rows to fetch at a time with the cursor
# More info on cursor.itersize https://www.psycopg.org/docs/cursor.html#cursor.itersize
CURSOR_ITERSIZE = 100

# More info about the public DrugCentral Postgres database https://drugcentral.org/download
Expand Down Expand Up @@ -47,6 +48,7 @@ def cursor(self):
if not getattr(self, "_cursor", None):
if self.client:
self._cursor = self.client.cursor()
self._cursor.itersize = self.CURSOR_ITERSIZE
else:
self.logger.warning(
"_cursor was not initialized and client is not active."
Expand Down

0 comments on commit 1224d96

Please sign in to comment.