exasol / advanced-analytics-framework

Framework for building complex data analysis algorithms with Exasol
MIT License
0 stars 0 forks source link

Extended usage scenario: Create, Validate, and Add to User Guide #195

Open ckunki opened 1 month ago

ckunki commented 1 month ago

In the scope of ticket #26 we added a user guide to AAF.

The current ticket requests to enhance the user guide by describing an extended usage scenario (EUS).

Features

Section "Usage" of the user guide should explain that an algorithm is implemented as QueryHandler and what a QueryHandler is.

Demonstrate using

Acceptance Criteria

  1. The EUS is Created, Validated (manually), and Added to User Guide
  2. The EUS Covers all the features described above
  3. There is an integration test verifying that the example is working correctly
  4. The existing sample usage image is updated, or another image is added explaining the EUS
ckunki commented 1 month ago

Method start():

  1. write parameter+"bucketfs"+time to temp bucketfs file
  2. create temp table: add to query_list two more statements:
    a. SelectQuery with CREATE b. SelectQuery with INSERT
  3. insert parameter+"table-insert"+time to temp table
  4. Return query select from temp table and concat "return"
from datetime import datetime
from exasol.bucketfs import as_string

    def start(self) -> Union[Continue, Finish[str]]:
        def sample_content(key: str) -> str:
            timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
            return f"{timestamp} {key} {self.parameter}"

        self.bfs_proxy = self.query_handler_context.get_temporary_bucketfs_location()
        self._bfs_file(self.bfs_proxy).write(sample_content("bucketfs"))

Method handle_query_result():

  1. read result
  2. read temp bucketfs file
  3. create table from result
  4. insert temp bucketfs file content into new table
  5. return new table name
    def handle_query_result(self, query_result: QueryResult) -> Union[Continue, Finish[str]]:
        s = as_string(self._bfs_file(self.bfs_proxy).read())

See also

tkilias commented 1 month ago

@ckunki Maybe we make actually a test case out of it

ckunki commented 1 month ago

Same thought here :slightly_smiling_face: I added an item to the acceptance criteria