-
Notifications
You must be signed in to change notification settings - Fork 9
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 #22
Open
ag-ramachandran
wants to merge
16
commits into
dodopizza:main
Choose a base branch
from
ag-ramachandran:feature/AddAggregateSupport
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/add aggregate support #22
ag-ramachandran
wants to merge
16
commits into
dodopizza:main
from
ag-ramachandran:feature/AddAggregateSupport
+606
−49
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
ag-ramachandran
commented
Dec 10, 2024
- Adds support for all aggregates (in the context of superset)
- Adds additional tests
- Bumps library versions
* 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.