Business Glossary Services
The Business Glossary Services module manages predefined SQL queries associated with specific business terms or jargon. By storing these definitions, KAI can intelligently query and handle specific business terms, enhancing its ability to process and understand business-related queries.
Key Components
Imports
HTTPException: Manages exceptions related to HTTP requests.BusinessGlossaryRequest&UpdateBusinessGlossaryRequest: Models for handling incoming requests to create or update business glossaries.BusinessGlossary: The model representing a business glossary entity.BusinessGlossaryRepository: Repository for interacting with the business glossary database.DatabaseConnectionRepository: Repository for managing database connections.
BusinessGlossaryServiceClassThe
BusinessGlossaryServiceclass encapsulates the business logic for managing business glossaries. It interacts with theBusinessGlossaryRepositoryto perform CRUD operations and validate database connections.Initialization
__init__(self, storage): Initializes the service with a storage object, typically a database connection, and sets up theBusinessGlossaryRepository.
Methods
get_business_glossaries(self, db_connection_id) -> list[BusinessGlossary]Retrieves all business glossaries associated with a specific database connection.
Filters glossaries by the
db_connection_id.
create_business_glossary(self, db_connection_id: str, business_glossary_request: BusinessGlossaryRequest) -> BusinessGlossaryCreates a new business glossary entry based on the provided request data.
Validates the existence of the associated database connection.
Returns the newly created
BusinessGlossaryobject.
get_business_glossary(self, business_glossary_id) -> BusinessGlossaryRetrieves a business glossary by its ID.
Raises an
HTTPExceptionif the business glossary is not found.
update_business_glossary(self, business_glossary_id, request: UpdateBusinessGlossaryRequest) -> BusinessGlossaryUpdates an existing business glossary with new data.
Applies changes only to the fields provided in the
UpdateBusinessGlossaryRequest.Returns the updated
BusinessGlossaryobject.
delete_business_glossary(self, business_glossary_id) -> dictDeletes a business glossary by its ID.
Verifies the existence of the business glossary before deletion.
Returns a success status if the deletion is successful.
Usage Scenarios
Creating Business Glossaries: The
create_business_glossarymethod allows users to define new business metrics, aliases, and SQL queries, linking them to specific database connections.Retrieving Glossaries: Use
get_business_glossariesorget_business_glossaryto access stored business glossary entries, facilitating the organization and retrieval of business-related definitions.Updating Glossaries: The
update_business_glossarymethod enables users to modify existing glossary entries, ensuring they remain accurate and up-to-date.Deleting Glossaries: The
delete_business_glossarymethod allows for the removal of glossary entries that are no longer needed, maintaining a clean and relevant glossary database.
Last updated