Skip to content

Methods in Linker.misc

Miscellaneous methods on the linker that don't fit into other categories. Accessed via linker.misc.

save_model_to_json(out_path=None, overwrite=False)

Save the configuration and parameters of the linkage model to a .json file.

The model can later be loaded into a new linker using `Linker(df, settings="path/to/model.json", db_api=db_api).

The settings dict is also returned in case you want to save it a different way.

Examples:

linker.misc.save_model_to_json("my_settings.json", overwrite=True)

Returns:

Name Type Description
dict dict[str, Any]

The settings as a dictionary.

query_sql(sql, output_type='pandas')

Run a SQL query against your backend database and return the resulting output.

Examples:

linker = Linker(df, settings, db_api)
df_predict = linker.inference.predict()
linker.misc.query_sql(f"select * from {df_predict.physical_name} limit 10")

Parameters:

Name Type Description Default
sql str

The SQL to be queried.

required
output_type str

One of splink_df/splinkdf or pandas. This determines the type of table that your results are output in.

'pandas'