description_extractors
langroid/agent/special/sql/utils/description_extractors.py
extract_postgresql_descriptions(engine, multi_schema=False)
¶
Extracts descriptions for tables and columns from a PostgreSQL database.
This method retrieves the descriptions of tables and their columns from a PostgreSQL database using the provided SQLAlchemy engine.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
engine |
Engine
|
SQLAlchemy engine connected to a PostgreSQL database. |
required |
multi_schema |
bool
|
Generate descriptions for all schemas in the database. |
False
|
Returns:
Type | Description |
---|---|
Dict[str, Dict[str, Any]]
|
Dict[str, Dict[str, Any]]: A dictionary mapping table names to a |
Dict[str, Dict[str, Any]]
|
dictionary containing the table description and a dictionary of |
Dict[str, Dict[str, Any]]
|
column descriptions. |
Source code in langroid/agent/special/sql/utils/description_extractors.py
extract_mysql_descriptions(engine, multi_schema=False)
¶
Extracts descriptions for tables and columns from a MySQL database.
This method retrieves the descriptions of tables and their columns from a MySQL database using the provided SQLAlchemy engine.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
engine |
Engine
|
SQLAlchemy engine connected to a MySQL database. |
required |
multi_schema |
bool
|
Generate descriptions for all schemas in the database. |
False
|
Returns:
Type | Description |
---|---|
Dict[str, Dict[str, Any]]
|
Dict[str, Dict[str, Any]]: A dictionary mapping table names to a |
Dict[str, Dict[str, Any]]
|
dictionary containing the table description and a dictionary of |
Dict[str, Dict[str, Any]]
|
column descriptions. |
Source code in langroid/agent/special/sql/utils/description_extractors.py
extract_default_descriptions(engine, multi_schema=False)
¶
Extracts default descriptions for tables and columns from a database.
This method retrieves the table and column names from the given database and associates empty descriptions with them.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
engine |
Engine
|
SQLAlchemy engine connected to a database. |
required |
multi_schema |
bool
|
Generate descriptions for all schemas in the database. |
False
|
Returns:
Type | Description |
---|---|
Dict[str, Dict[str, Any]]
|
Dict[str, Dict[str, Any]]: A dictionary mapping table names to a |
Dict[str, Dict[str, Any]]
|
dictionary containing an empty table description and a dictionary of |
Dict[str, Dict[str, Any]]
|
empty column descriptions. |
Source code in langroid/agent/special/sql/utils/description_extractors.py
extract_schema_descriptions(engine, multi_schema=False)
¶
Extracts the schema descriptions from the database connected to by the engine.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
engine |
Engine
|
SQLAlchemy engine instance. |
required |
multi_schema |
bool
|
Generate descriptions for all schemas in the database. |
False
|
Returns:
Type | Description |
---|---|
Dict[str, Dict[str, Any]]
|
Dict[str, Dict[str, Any]]: A dictionary representation of table and column |
Dict[str, Dict[str, Any]]
|
descriptions. |