-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add aggregate support merge #25
Feature/add aggregate support merge #25
Conversation
* Update library revisions
…anipulate a temporary table in Azure Data Explorer (Kusto) for testing purposes. It includes several functions and fixtures to set up, run tests, and tear down the test environment. Below is a breakdown of what each part of the code does: 1. **Imports and Setup**: - The script imports necessary modules such as `pytest`, `uuid`, `KustoConnectionStringBuilder`, etc. These are used for creating connections to Azure Data Explorer, handling database operations, and managing test fixtures. 2. **Helper Functions**: - `get_kcsb()`: This function returns a Kusto connection string based on the authentication method (Azure CLI or AAD application key). - `_create_temp_table(table_name: str)`: Creates a temporary table with specified columns (`Id` and `Text`). - `_create_temp_fn(fn_name: str)`: Creates a temporary function that prints the current time. - `_ingest_data_to_table(table_name: str)`: Ingests sample data into the specified table. - `_drop_table(table_name: str)`: Drops the specified table and its associated function after testing. 3. **Fixtures**: - `temp_table_name()`: Generates a unique name for the temporary table using UUID. - `run_around_tests(temp_table_name)`: This fixture sets up the test environment by creating a temporary table and its function, ingesting data into the table, and then tearing down the table after the tests are run. 4. **Tests**: - The commented-out functions (`test_fizzbuzz` and `test_limit`) were intended to be unit tests but are not implemented in the provided code. These would typically contain assertions to verify the behavior of the Kusto queries or other operations. 5. **KustoClient**: - The script uses the `KustoClient` class from the `azure-kusto-data` library to interact with Azure Data Explorer, executing commands to create tables, functions, and ingest data. ### Example of How to Use the Fixture Here's an example of how you might use the `temp_table_name` fixture in a test: ```python def test_something(temp_table_name): # Now you can use temp_table_name as a unique table name for your tests assert isinstance(temp_table_name, str) # Just an example assertion ``` ### Running the Tests To run these tests, you would typically set up a testing environment that includes Azure Data Explorer and ensure that the necessary credentials are configured. You can then execute pytest to run the tests: ```bash pytest your_test_file.py ``` This script is useful for ensuring that your Kusto queries and interactions work as expected in an isolated test environment, allowing you to write reliable and repeatable unit tests.
* Fix failing tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@ag-ramachandran thank you for your PR. You can merge if everything is ready. After that, I will release a new version of the library |
Thanks a lot @pa1ch. I do not have merge privileges :) |
Hello @pa1ch , making 1 more small fix. I will confirm on the merge. There is one additional set of tests/filters i have to add |
No description provided.