Skip to main content

sc_crawler.insert

Helpers to validate and bulk insert per-vendor records into the database.

Functions:

func can_bulk_insert insert.py:22–24⁠ (opens in a new tab)​

can_bulk_insert(session)

Checks if bulk insert is supported for the engine dialect of a SQLModel session.

func validate_items insert.py:80–117⁠ (opens in a new tab)​

validate_items(model, items, vendor=None, prefix='')

Validates a list of items against a pydantic.BaseModel⁠ (opens in a new tab) definition.

Parameters:

Returns:

func bulk_insert_items insert.py:120–178⁠ (opens in a new tab)​

bulk_insert_items(model, items, vendor=None, session=None, progress=None, prefix='')

Bulk inserts items into a SQLModel table with ON CONFLICT update.

Parameters:

func insert_items insert.py:181–239⁠ (opens in a new tab)​

insert_items(model, items, vendor=None, session=None, progress=None, prefix='')

Insert items into the related database table using bulk or merge.

Bulk insert is only supported with SQLite and PostgreSQLPostgreSQLAn open-source object-relational database system, developed by a global community and descended from the POSTGRES project at UC Berkeley in 1986. It uses and extends SQL, with transactions, many index types, extensions, and JSON data.PostgreSQL docsGlossary, other databases fall back to the default session.merge (slower) approach.

Parameters: