Skip to content

Extract

matchbox.client.extract

Functions to extract data out of the Matchbox server.

Functions:

  • sql_interface

    Generate snapshot and DDL implmenting SQL interface to results.

sql_interface

sql_interface(
    resolution_name: str, engine: Engine, mapping_table: str
) -> tuple[Table, Table, str]

Generate snapshot and DDL implmenting SQL interface to results.

Parameters:

  • resolution_name

    (str) –

    Name of the resolution from which to generate results

  • engine

    (Engine) –

    SQLAlchemy engine of warehouse running SQL interface

  • mapping_table

    (str) –

    The name (+ schema) where the mapping table will be written.

Returns:

  • tuple[Table, Table, str]

    A tuple of 3 items containing:

    • A PyArrow table mapping from Matchbox IDs to all source PKs
    • A PyArrow table mapping sources and columns to column names in the view
    • The DQL definition of a view to use for querying results in SQL