### Install Omni Python SDK Source: https://github.com/exploreomni/omni-python-sdk/blob/main/README.md Installs the Omni Python SDK and its dependencies from `requirements.txt` using pip. ```bash pip install -r requirements.txt ``` -------------------------------- ### Execute Omni Query via Command Line Interface Source: https://github.com/exploreomni/omni-python-sdk/blob/main/README.md Demonstrates how to run a predefined Omni query using a command-line Python script, passing the API key, base URL, and the full JSON query object as arguments. This provides a quick way to interact with the API without writing a full Python script. ```bash python3 examples/query.py OMNI_API_KEY https://OMNI_URL '{"query": {"sorts": [{"column_name": "omni_dbt__order_items.created_at[date]", "sort_descending": false}], "table": "omni_dbt__order_items", "fields": ["omni_dbt__order_items.created_at[date]", "omni_dbt__order_items.total_sale_price"], "modelId": "OMNI_MODEL_ID", "join_paths_from_topic_name": "order_items"}}' ``` -------------------------------- ### Query Omni API and Process Results with Pandas Source: https://github.com/exploreomni/omni-python-sdk/blob/main/README.md Illustrates how to initialize the `OmniAPI` client, define a structured query object, execute the query to retrieve data, and convert the returned table into a Pandas DataFrame for further analysis. It highlights API key and base URL configuration, including optional environment variable loading. ```python from omni_python_sdk import OmniAPI # Set your API key and base URL api_key = "your_api_key" base_url = "https://your_domain.omniapp.co" #these can optionally be set in an .env file with the following keys: # OMNI_API_KEY=<> # OMNI_BASE_URL=<> # Define your query query = { "query": { "sorts": [ { "column_name": "order_items.created_at[date]", "sort_descending": False } ], "table": "order_items", "fields": [ "order_items.created_at[date]", "order_items.sale_price_sum" ], "modelId": "your_model_id", "join_paths_from_topic_name": "order_items" } } # Initialize the API with your credentials api = OmniAPI(api_key, base_url) # if you've optionally set your keys in a .env file no arguments are required: # api = OmniAPI() # if your environment variables are stored in an alternative location # api = OmniAPI(env_file='<>') # Run the query and get a table table = api.run_query_blocking(query) # Convert the table to a Pandas DataFrame df = table.to_pandas() # Display the first few rows of the DataFrame print(df.head()) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.