freesearch module

class FreeSearch(database, label='Frisøk')

Bases: ABC

Base class for creating a free-text SQL query interface with results displayed in an AgGrid table.

This class serves as a template for modules that allow users to: - Enter SQL queries in a text area. - Optionally specify partition filters as a dictionary string. - Display query results in an editable Dash AgGrid table.

Parameters:
  • database (Any)

  • label (str)

database

Database connection or interface for executing SQL queries.

Type:

Any

label

Label for the module, defaults to “🔍 Frisøk”.

Type:

str

module_layout

The generated layout for the module.

Type:

html.Div

layout()

Abstract method to define the module’s layout.

Return type:

Div

module_callbacks()

Registers the Dash callbacks for interactivity.

Return type:

None

abstract layout()

Define the layout for the FreeSearch module.

This is an abstract method that must be implemented by subclasses to define the module’s layout.

Returns:

A Dash HTML Div component representing the layout of the module.

Return type:

html.Div

module_callbacks()

Register the Dash callbacks for the FreeSearch module.

This method registers a callback to execute the SQL query when the “kjør” button is clicked. The query results are displayed in the AgGrid table, with appropriate column definitions.

Return type:

None

Notes

  • The callback takes user inputs from the SQL query text area and partition filter input field.

  • The results are displayed in an editable table, with the “row_id” column hidden by default if present.

class FreeSearchTab(database)

Bases: TabImplementation, FreeSearch

Implementation of the FreeSearch module as a tab in the application.

This class extends the FreeSearch base class and provides a layout specific to the tab interface.

Parameters:

database (Any)

class FreeSearchWindow(database)

Bases: WindowImplementation, FreeSearch

FreeSearchWindow is a class that creates a modal based on the FreeSearch module.

Parameters:

database (Any)