### Install Kinetica Python API via PyPI Source: https://docs.kinetica.com/7.2/aws/guides/solve_graph_seattle_multi_route Installs the Kinetica Python API using pip. Ensure a Python virtual environment is activated before installation. This method is suitable for most users who want to quickly set up the API. ```bash pip3 install gpudb ``` -------------------------------- ### Install Kinetica Python API from Local Git Clone Source: https://docs.kinetica.com/7.2/aws/guides/solve_graph_seattle_multi_route Installs the Kinetica Python API after cloning the repository. Navigate to the repository's root directory and use 'sudo pip3 install .' to install. Requires Python 3. ```bash sudo pip3 install . ``` -------------------------------- ### Install Kinetica Python API Source: https://docs.kinetica.com/7.2/aws/guides/python-udf-guide Installs the Kinetica Python API locally. This process involves changing into the API's repository directory and running the setup script. This makes the API available for use in your Python projects. ```bash cd kinetica-api-python sudo python3 setup.py install ``` -------------------------------- ### Python Virtual Environment Setup Source: https://docs.kinetica.com/7.2/aws/guides/match_graph_seattle_markov Demonstrates how to create and activate a Python virtual environment. Virtual environments isolate project dependencies, preventing conflicts between different projects. This is crucial for managing Python installations effectively. ```shell python3 -m venv .venv source .venv/bin/activate ``` -------------------------------- ### Navigate to UDF Distributed Model Example Directory Source: https://docs.kinetica.com/7.2/udf/python/examples/github_examples/dist_model Changes the current directory into the specific example directory for the distributed model UDF. This is where the setup and execution scripts for the UDF example are located. ```bash cd examples/UDF_distributed_model ``` -------------------------------- ### Install Kinetica Python API via PyPI Source: https://docs.kinetica.com/7.2/aws/guides/match_graph_seattle_markov Installs the Kinetica Python API using pip, a package installer for Python. This is a straightforward method for adding the API to your Python environment. It verifies the installation by attempting to import the library. ```shell pip3 install gpudb python3 -c "import gpudb;print('Import Successful')" ``` -------------------------------- ### Install RKinetica from Prebuilt Package in R Source: https://docs.kinetica.com/7.2/aws/connectors/r_guide Installs the RKinetica R package from a downloaded tar.gz file. This method requires the package file to be present locally and is recommended over manual building. ```R install.packages("/path/to/RKinetica_.tar.gz", repos = NULL, type = "source") ``` -------------------------------- ### Install Kinetica Python API Source: https://docs.kinetica.com/7.2/aws/udf/python/examples/github_examples/pandas Installs the Kinetica Python API client library. The `~=7.2.0` specifies a compatible version, ensuring proper interaction with your Kinetica instance. ```bash pip install gpudb~=7.2.0 ``` -------------------------------- ### Kinetica ODBC DSN URL Example Source: https://docs.kinetica.com/7.2/aws/connectors/sql_guide Provides an example of a configured URL for a Kinetica ODBC DSN, including host, cluster name, and parameters. ```text https://abcdefg.cloud.kinetica.com/hijklmn/gpudb-0;CombinePrepareAndExecute=1;RowsPerFetch=20000 ``` -------------------------------- ### Run Kinetica Table Monitor Example Script Source: https://docs.kinetica.com/7.2/aws/guides/table_monitor This command executes a complete Python example script (`table_monitor.py`) for the Kinetica Table Monitor API. It requires specifying the Kinetica URL, username, and password as arguments. Note that running this script requires system administrator permissions due to the creation of schemas and database objects. ```bash python table_monitor.py [--url ] --username --password ``` -------------------------------- ### Test Kinetica Python API Installation Source: https://docs.kinetica.com/7.2/aws/guides/solve_graph_seattle_multi_route Verifies the successful installation of the Kinetica Python API by importing the 'gpudb' library. If 'Import Successful' is displayed, the API is ready for use. ```python python3 -c "import gpudb;print('Import Successful')" ``` -------------------------------- ### EXPLAIN with Detail Example Source: https://docs.kinetica.com/7.2/sql/query This endpoint demonstrates how to get a detailed JSON-formatted execution plan for a given SQL query, including information about distributed operations and join details. ```APIDOC ## POST /explain ### Description Retrieves a detailed JSON-formatted execution plan for a given SQL query. This can include information about distributed operations, join details, and potential query errors. ### Method POST ### Endpoint /explain ### Parameters #### Request Body - **query** (string) - Required - The SQL query for which to generate an execution plan. - **options** (object) - Optional - Additional options for the explain query. Example: `{"create_explain": true, "show_filters": true, "ttl": -1}` ### Request Example ```json { "query": "EXPLAIN VERBOSE ANALYZE FORMAT JSON SELECT * FROM example.explain_table t1 JOIN example.explain_table t2 ON t1.shard_column = t2.not_shard_column" } ``` ### Response #### Success Response (200) - **PLAN** (array) - An array of objects, where each object represents a step in the execution plan. Includes details like `ENDPOINT`, `COLUMNS`, `EXPRESSIONS`, `JSON_REQUEST`, `TABLE_DEFINITIONS`, etc. #### Response Example ```json { "PLAN": [ { "ADDITIONAL_INFO": "Not all of the non-replicated tables are equated by shard keys. Number of sharded sets: 2, Number of components connected: 0 (REF)", "COLUMNS": "TableAlias_0_.shard_column AS shard_column,TableAlias_0_.not_shard_column AS not_shard_column,TableAlias_1_.shard_column AS shard_column0,TableAlias_1_.not_shard_column AS not_shard_column0", "DEPENDENCIES": "-1", "ENDPOINT": "/create/jointable", "EXPRESSIONS": "inner join TableAlias_0_, TableAlias_1_ on (TableAlias_0_.shard_column = TableAlias_1_.not_shard_column ) ", "ID": "0", "INFO": "{\"estimate_input_row_counts\":\"1.0, 1.0\",\"estimate_row_count\":\"1.0\"}", "JSON_REQUEST": "{ \"join_table_name\": \"sys_sql_temp.Join_1_01234567_89ab_cdef_0123_456789abcdef\", \"table_names\": [ \"example.explain_table AS TableAlias_0_\", \"example.explain_table AS TableAlias_1_\" ], \"column_names\": [ \"TableAlias_0_.shard_column AS shard_column\", \"TableAlias_0_.not_shard_column AS not_shard_column\", \"TableAlias_1_.shard_column AS shard_column0\", \"TableAlias_1_.not_shard_column AS not_shard_column0\" ], \"expressions\": [ \"inner join TableAlias_0_, TableAlias_1_ on (TableAlias_0_.shard_column = TableAlias_1_.not_shard_column ) \" ], \"options\": { \"create_explain\": \"true\", \"show_filters\": \"true\", \"ttl\": \"-1\" } }", "LAST_USE_TABLES": "", "OPTIONS": "{create_explain,true} {show_filters,true} {ttl,-1}", "RESULT_DISTRIBUTION": "NA / ;", "RESULT_ROWS": "0", "RUN_TIME": "0", "TABLE_DEFINITIONS": "CREATE TABLE \"example\".\"explain_table\"\r\n (\r\n \"shard_column\" INTEGER (shard_key),\r\n \"not_shard_column\" INTEGER\r\n )\r\n TIER STRATEGY (\r\n ( ( VRAM 1, RAM 5, DISK0 5, PERSIST 5 ) )\r\n );\n CREATE TABLE \"example\".\"explain_table\"\r\n (\r\n \"shard_column\" INTEGER (shard_key),\r\n \"not_shard_column\" INTEGER\r\n )\r\n TIER STRATEGY (\r\n ( ( VRAM 1, RAM 5, DISK0 5, PERSIST 5 ) )\r\n );" }, { "ADDITIONAL_INFO": "", "COLUMNS": "shard_column AS shard_column, not_shard_column AS not_shard_column, shard_column0 AS shard_column0, not_shard_column0 AS not_shard_column0", "DEPENDENCIES": "0", "ENDPOINT": "/get/records/bycolumn", "EXPRESSIONS": "", "ID": "1", "INFO": "", "JSON_REQUEST": "{ \"table_name\": \"sys_sql_temp.Join_1_01234567_89ab_cdef_0123_456789abcdef\", \"column_names\": [ \"shard_column AS shard_column\", \"not_shard_column AS not_shard_column\", \"shard_column0 AS shard_column0\", \"not_shard_column0 AS not_shard_column0\" ], \"offset\": 0, \"limit\": -9999, \"encoding\": \"binary\", \"options\": {} }", "LAST_USE_TABLES": "sys_sql_temp.Join_1_01234567_89ab_cdef_0123_456789abcdef", "OPTIONS": "", "RESULT_DISTRIBUTION": "", "RESULT_ROWS": "0", "RUN_TIME": "0", "TABLE_DEFINITIONS": "" } ] } ``` ``` -------------------------------- ### Kinetica JDBC URL Syntax and Example Source: https://docs.kinetica.com/7.2/aws/connectors/sql_guide Provides the general syntax for constructing a Kinetica JDBC connection URL and a practical example for connecting to a cloud-hosted Kinetica instance. ```sql jdbc:kinetica:URL=https:////gpudb-0;CombinePrepareAndExecute=1[[;=]*] ``` ```sql jdbc:kinetica:URL=https://abcdefg.cloud.kinetica.com/hijklmn/gpudb-0;CombinePrepareAndExecute=1;RowsPerFetch=20000 ``` -------------------------------- ### Kinetica JDBC Connection String Example Source: https://docs.kinetica.com/7.2/aws/connectors/sql_guide Provides a practical example of a JDBC connection string for Kinetica, including sample host, cluster name, and common parameters like RowsPerFetch. ```text jdbc:kinetica:URL=https://abcdefg.cloud.kinetica.com/hijklmn/gpudb-0;CombinePrepareAndExecute=1;RowsPerFetch=20000 ``` -------------------------------- ### Start Table Monitor Clients Source: https://docs.kinetica.com/7.2/aws/guides/table_monitor This Python code demonstrates how to start table monitor clients using the Kinetica API. It involves instantiating specific client classes like StatusUpdater and StatusReporter with a database handle and then invoking their respective `start_monitor` methods. This is essential for initiating the monitoring process. ```python status_updater = StatusUpdater(kinetica) status_reporter = StatusReporter(kinetica) status_updater.start_monitor() status_reporter.start_monitor() ``` -------------------------------- ### Explain with Detail Example Source: https://docs.kinetica.com/7.2/aws/sql/query This endpoint demonstrates how to get detailed execution plans for queries, including error information if processing fails. ```APIDOC ## POST /create/jointable ### Description This endpoint is used to create a join table and generate an explain plan for the join operation. It can also include query error details if the execution fails. ### Method POST ### Endpoint /create/jointable ### Parameters #### Request Body - **join_table_name** (string) - Required - The name for the new join table. - **table_names** (array of strings) - Required - A list of table names to be joined, with optional aliases. - **column_names** (array of strings) - Required - A list of column names to select, with optional aliases. - **expressions** (array of strings) - Required - The join expressions, including join type and conditions. - **options** (object) - Optional - Additional options for table creation and explain plan generation. - **create_explain** (string) - "true" to create an explain plan. - **show_filters** (string) - "true" to show filters in the explain plan. - **ttl** (string) - Time-to-live for the temporary table. ### Request Example ```json { "join_table_name": "sys_sql_temp.Join_1_01234567_89ab_cdef_0123_456789abcdef", "table_names": [ "example.explain_table AS TableAlias_0_", "example.explain_table AS TableAlias_1_" ], "column_names": [ "TableAlias_0_.shard_column AS shard_column", "TableAlias_0_.not_shard_column AS not_shard_column", "TableAlias_1_.shard_column AS shard_column0", "TableAlias_1_.not_shard_column AS not_shard_column0" ], "expressions": [ "inner join TableAlias_0_, TableAlias_1_ on (TableAlias_0_.shard_column = TableAlias_1_.not_shard_column ) " ], "options": { "create_explain": "true", "show_filters": "true", "ttl": "-1" } } ``` ### Response #### Success Response (200) - **PLAN** (array of objects) - Contains details of the execution plan and query results. - **ADDITIONAL_INFO** (string) - Additional information about the plan. - **COLUMNS** (string) - Selected columns. - **DEPENDENCIES** (string) - Dependencies of the plan. - **ENDPOINT** (string) - The endpoint associated with this plan step. - **EXPRESSIONS** (string) - Join expressions used. - **ID** (string) - Unique identifier for the plan step. - **INFO** (string) - Estimated row counts and other information. - **JSON_REQUEST** (string) - The original JSON request that generated this plan step. - **LAST_USE_TABLES** (string) - Tables used in the last operation. - **OPTIONS** (string) - Options applied to this step. - **RESULT_DISTRIBUTION** (string) - Distribution of result data. - **RESULT_ROWS** (string) - Number of rows in the result. - **RUN_TIME** (string) - Execution time for this step. - **TABLE_DEFINITIONS** (string) - SQL definitions of tables involved. #### Response Example ```json { "PLAN": [ { "ADDITIONAL_INFO": "Not all of the non-replicated tables are equated by shard keys. Number of sharded sets: 2, Number of components connected: 0 (REF)", "COLUMNS": "TableAlias_0_.shard_column AS shard_column,TableAlias_0_.not_shard_column AS not_shard_column,TableAlias_1_.shard_column AS shard_column0,TableAlias_1_.not_shard_column AS not_shard_column0", "DEPENDENCIES": "-1", "ENDPOINT": "/create/jointable", "EXPRESSIONS": "inner join TableAlias_0_, TableAlias_1_ on (TableAlias_0_.shard_column = TableAlias_1_.not_shard_column ) ", "ID": "0", "INFO": "{\"estimate_input_row_counts\":\"1.0, 1.0\",\"estimate_row_count\":\"1.0\"}", "JSON_REQUEST": "{\n \"join_table_name\": \"sys_sql_temp.Join_1_01234567_89ab_cdef_0123_456789abcdef\",\n \"table_names\": [\n \"example.explain_table AS TableAlias_0_\",\n \"example.explain_table AS TableAlias_1_\"\n ],\n \"column_names\": [\n \"TableAlias_0_.shard_column AS shard_column\",\n \"TableAlias_0_.not_shard_column AS not_shard_column\",\n \"TableAlias_1_.shard_column AS shard_column0\",\n \"TableAlias_1_.not_shard_column AS not_shard_column0\"\n ],\n \"expressions\": [\n \"inner join TableAlias_0_, TableAlias_1_ on (TableAlias_0_.shard_column = TableAlias_1_.not_shard_column ) \"\n ],\n \"options\": {\n \"create_explain\": \"true\",\n \"show_filters\": \"true\",\n \"ttl\": \"-1\"\n }\n}", "LAST_USE_TABLES": "", "OPTIONS": "{create_explain,true} {show_filters,true} {ttl,-1}", "RESULT_DISTRIBUTION": "NA / ;", "RESULT_ROWS": "0", "RUN_TIME": "0", "TABLE_DEFINITIONS": "CREATE TABLE \"example\".\"explain_table\"\r\n (\r\n \"shard_column\" INTEGER (shard_key),\r\n \"not_shard_column\" INTEGER\r\n )\r\n TIER STRATEGY (\r\n ( ( VRAM 1, RAM 5, DISK0 5, PERSIST 5 ) )\r\n );\n CREATE TABLE \"example\".\"explain_table\"\r\n (\r\n \"shard_column\" INTEGER (shard_key),\r\n \"not_shard_column\" INTEGER\r\n )\r\n TIER STRATEGY (\r\n ( ( VRAM 1, RAM 5, DISK0 5, PERSIST 5 ) )\r\n );" } ] } ``` ``` -------------------------------- ### Run Complete Sample Script (Shell) Source: https://docs.kinetica.com/7.2/guides/match_graph_dc_multi_supply_demand This shell command demonstrates how to run the complete example script for matching graph supply and demand, including optional parameters for Kinetica URL, username, password, and data file directory. ```bash python match_graph_dc_multi_supply_demand.py [--url ] --username --password [--data_dir ] ``` -------------------------------- ### Quick Start Guide: SQL-GPT on AWS Source: https://docs.kinetica.com/7.2/aws-guide-tags/sql-gpt A quick start guide for using SQL-GPT with AWS. It covers essential steps for initial setup and usage, focusing on geospatial ingestion and SQL queries. ```sql Quick Start Geospatial Ingest SQL SQL-GPT Visualization ``` -------------------------------- ### Clone Kinetica Python UDF Tutorial Repository Source: https://docs.kinetica.com/7.2/aws/guides/python-udf-guide Downloads the Kinetica Python UDF tutorial repository. This repository contains the example UDF management program and the UDF code itself. It is essential for following the tutorial. ```bash git clone -b release/v7.2 --single-branch https://github.com/kineticadb/kinetica-tutorial-python-udf-api.git ``` -------------------------------- ### Initializing the Map with Kickbox.js Source: https://docs.kinetica.com/7.2/aws/connectors/kickbox_wms Includes instructions for adding Kickbox.js and its stylesheet, and demonstrates how to initialize the Mapbox map with Kinetica authentication. ```APIDOC ## Initializing the Map ### Description First, ensure Kinetica Kickbox.js and its stylesheet are included in the HTML page. The map will have to be initialized before a Kinetica WMS layer can be added to it. Map initialization via `initMap` is promisified, so that initialization is guaranteed to complete before any layers are added, avoiding startup errors. Since this initialization function sets up basic authentication for Kinetica and connects to the Mapbox API all at once, it is intended to replace the existing map initialization function provided by Mapbox. ### Method `kickbox.initMap(options)` ### Endpoint N/A (Client-side JavaScript) ### Parameters #### Request Body - **mapboxgl** (object) - Required - The Mapbox GL object. - **kineticaUrl** (string) - Required - The base URL for the Kinetica instance. - **wmsUrl** (string) - Required - The WMS URL for the Kinetica instance. - **mapboxKey** (string) - Required - Your Mapbox API key. - **mapDiv** (string) - Required - The ID of the HTML element where the map will be rendered. - **username** (string) - Required - Kinetica username for authentication. - **password** (string) - Required - Kinetica password for authentication. ### Request Example ```javascript kickbox.initMap({ mapboxgl: , kineticaUrl: 'https:////gpudb-0', wmsUrl: 'https:////gpudb-0/wms', mapboxKey: '', mapDiv: '', username: '', password: '' }).then(function(map){ /* ... */ }) ``` ### Response #### Success Response (Promise resolves with Mapbox Map object) - **map** (object) - The initialized Mapbox map object. ``` -------------------------------- ### Clean Kinetica Artifacts Source: https://docs.kinetica.com/7.2/install/kagent_install Removes all Kinetica artifacts from the filesystem, including the installation directory. ```bash sudo rm -rf /opt/gpudb ``` -------------------------------- ### Run Complete Sample Script Source: https://docs.kinetica.com/7.2/aws/guides/match_graph_dc_multi_supply_demand This command demonstrates how to execute the complete sample script for matching supply and demand using the Kinetica graph solver. It includes optional parameters for specifying the Kinetica URL, username, password, and the directory containing the data files. ```bash python match_graph_dc_multi_supply_demand.py [--url ] --username --password [--data_dir ] ``` -------------------------------- ### Initialize Aggregate Histogram Parameters in Kinetica Source: https://docs.kinetica.com/7.2/aws/guides/cpp_guide This code initializes variables for an aggregate histogram operation in Kinetica. It sets the range start, range end, and interval for the histogram. This is a setup step before calling the actual histogram aggregation function. Dependencies include basic C++ data types. ```c++ // Aggregate Histogram std::cout << "Calling aggregateHistogram. "; double range_start = 0.0; double range_end = 11; double interval = 1; ``` -------------------------------- ### Run SQL Tutorial Script using KiSQL Source: https://docs.kinetica.com/7.2/guides/sql_guide This command shows how to execute a SQL tutorial script named 'sql_tutorial.kisql' using the KiSQL client. It requires specifying the database URL, username, and the path to the SQL file. This is typically used for running a set of predefined SQL commands for learning or setup purposes. ```bash $ kisql --url http://:9191 --user --file sql_tutorial.kisql ``` -------------------------------- ### Run Complete Example Source: https://docs.kinetica.com/7.2/aws/guides/isochrones Instructions on how to download and run a complete example script for isochrone generation, including prerequisites and command-line arguments. ```APIDOC ## Download & Run ### Description This section provides instructions to run a complete sample script (`isochrones.py`) for isochrone generation. It details the necessary files, prerequisites, and command-line arguments required to execute the script. ### Prerequisites - Ensure the `isochrones.py` script is in the current directory. - Ensure the `dc_shape.csv` data file is in the current directory or specify its location using the `data_dir` parameter. ### Method Command Line ### Command ```bash python isochrones.py [--url ] --username --password [--data_dir ] ``` ### Parameters - **url** (string) - Optional - The URL of the Kinetica instance. - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. - **data_dir** (string) - Optional - The directory containing the data files (e.g., `dc_shape.csv`). ### Example Output The script will generate an isochrone image and potentially other output files depending on the script's implementation. ``` -------------------------------- ### Run Example Script Source: https://docs.kinetica.com/7.2/aws/guides/solve_graph_seattle_multi_route Command to execute the complete example script for multiple routing solve. It allows specifying Kinetica URL, username, password, and an optional data directory for the input files. ```bash python solve_graph_seattle_multi_route.py [--url ] --username --password [--data_dir ] ``` -------------------------------- ### Install RKinetica from Tarball using R CMD Source: https://docs.kinetica.com/7.2/aws/connectors/r_guide Installs the RKinetica R package from a generated tar.gz file using the R CMD install command. This makes the package available for use in R. ```bash R CMD install RKinetica_.tar.gz ``` -------------------------------- ### Show All Resource Groups Example Source: https://docs.kinetica.com/7.2/sql/resource_group This example demonstrates how to display the configurations of all resource groups currently defined in the system using a single command. ```sql SHOW RESOURCE GROUP ALL ``` -------------------------------- ### Executing Database Setup Methods Source: https://docs.kinetica.com/7.2/udf/python/examples/github_examples/dist_model Calls core database setup methods: creating schema, preparing loan data, and creating the ensemble model table. These methods are part of the `test_environment` module. ```python te.create_schema() te.prepare_loan_data() te.create_ensemble_model_table() ``` -------------------------------- ### KiSQL Help Output Example Source: https://docs.kinetica.com/7.2/tools/kisql Shows an example of the output generated when the KiSQL help option ('-?') is used. This output typically includes connection parameters and other CLI flags. ```text Usage: kisql [-options] where options include: Connect: --url Connect to this GPUdb URL. Use either this option or -host/-port, but not both. Can also be specificed by the KI_URL environment variable ``` -------------------------------- ### GET /get/records/json Source: https://docs.kinetica.com/7.2/aws/snippets/json-egress Retrieves records from a table in JSON format. Supports filtering, aggregation, and custom column selection. Data can be passed as URL-encoded GET parameters. ```APIDOC ## GET /get/records/json ### Description This endpoint retrieves records from a specified table in JSON format. It allows for filtering data using an expression, specifying which columns to return (including aggregated columns), and applying a HAVING clause to filter aggregated results. The data-urlencode option is used to pass parameters as GET query parameters. ### Method GET ### Endpoint ${KINETICA_URL}/get/records/json ### Parameters #### Query Parameters - **table_name** (string) - Required - The name of the table to query. - **column_names** (string) - Required - A comma-separated list of column names or expressions to retrieve. Supports aggregation functions. - **expression** (string) - Optional - A filter expression to apply to the rows before aggregation. - **having** (string) - Optional - A filter expression to apply to the results after aggregation. ### Request Example ```bash curl -sSG ${KINETICA_URL}/get/records/json \ --header "Content-Type: application/json" \ --user "${USERNAME}:${PASSWORD}" \ --data-urlencode "table_name=${TABLE_NAME}" \ --data-urlencode "column_names=category,COUNT(1) AS total_products" \ --data-urlencode "expression=stock >= 1000" \ --data-urlencode "having=COUNT(1) > 1" ``` ### Response #### Success Response (200) - **columnNames** (array) - The names of the columns returned. - **records** (array) - An array of record objects, where each object represents a row with key-value pairs for the columns. - **totalNumRecords** (integer) - The total number of records returned. #### Response Example ```json { "columnNames": ["category", "total_products"], "records": [ {"category": "Electronics", "total_products": 150}, {"category": "Clothing", "total_products": 200} ], "totalNumRecords": 2 } ``` ``` -------------------------------- ### C++ Kinetica 7.2 Complete Sample Program Source: https://docs.kinetica.com/7.2/aws/guides/cpp_guide This C++ code snippet represents a complete sample program for Kinetica 7.2. It demonstrates the initialization of the GPUdb client, table creation with specified columns, data insertion, record retrieval, filtering data into views using expressions and lists, and dropping views. Dependencies include the Kinetica C++ client library. ```cpp #include #include const std::string COL_1 = "col1"; const std::string COL_2 = "col2"; const std::string COL_GROUP_ID = "group_id"; const std::string STR_GROUP_1_CONST = "Group 1"; const std::string STR_GROUP_2_CONST = "Group 2"; const std::string my_table("my_table_1"); // helper functions prototypes void print_GetRecordsResponse(const gpudb::GetRecordsResponse&); void insertRecordsLocal(gpudb::GPUdb& h_db, gpudb::Type myTypeSchema, int start, int end, double col1_const, std::string col2_const, std::string group_id_const, bool display_record_ids = false); int main(int argc, char *argv[]) { std::map options; gpudb::GPUdb h_db("https://abcdefg.cloud.kinetica.com/hijklmn/gpudb-0;CombinePrepareAndExecute=1;RowsPerFetch=20000"); std::vector columns; columns.push_back(gpudb::Type::Column(COL_1, gpudb::Type::Column::ColumnType::DOUBLE)); columns.push_back(gpudb::Type::Column(COL_2, gpudb::Type::Column::ColumnType::STRING)); columns.push_back(gpudb::Type::Column(COL_GROUP_ID, gpudb::Type::Column::ColumnType::STRING)); gpudb::Type myType("my_type_1", columns); std::string type_id_1 = myType.create(h_db); std::cout << "GPUdb generated type id for the new type - " << type_id_1 << std::endl; try { gpudb::CreateTableResponse response = h_db.createTable(my_table, type_id_1, options); } catch (const std::exception& ex) { std::cout << "Caught Exception: " << ex.what() << std::endl; return 10; } try { // Insert some records into the table insertRecordsLocal(h_db, myType, 1, 10, 0.1, "string ", STR_GROUP_1_CONST, true); // Call the helper function to Retrieve records from the table gpudb::GetRecordsResponse response = h_db.getRecords(myType, my_table, 0, 100, options); print_GetRecordsResponse(response); // Filter the records by an expression into a view std::string my_view("my_view_1"); std::string my_filterExpr("col1=1.1"); gpudb::FilterResponse filter_resp = h_db.filter(my_table, my_view, my_filterExpr, options); std::cout << "Number of records returned by filter expression: " << filter_resp.count << std::endl; // Retrieve records from the view response = h_db.getRecords(myType, my_view, 0, 100, options); print_GetRecordsResponse(response); // Drop the view (same function as dropping a table) gpudb::ClearTableResponse clrTbl_Resp = h_db.clearTable(my_view, "", options); // Apply a filter condition with two columns my_filterExpr = "col1 <= 9 and group_id=\"Group 1\""; filter_resp = h_db.filter(my_table, my_view, my_filterExpr, options); std::cout << "Number of records returned by second filter expression: " << filter_resp.count << std::endl; response = h_db.getRecords(myType, my_view, 0, 100, options); print_GetRecordsResponse(response); // Filter by a list of values. Note also query chaining - query run on another view. std::string my_view2("my_view_2"); std::map > my_filterList; my_filterList["col1"].push_back("1.1"); my_filterList["col1"].push_back("2.1"); my_filterList["col1"].push_back("5.1"); gpudb::FilterByListResponse filterByList_resp = h_db.filterByList(my_view, my_view2, my_filterList, options); std::cout << "Number of records returned by filter by list expression " << filterByList_resp.count << std::endl; response = h_db.getRecords(myType, my_view2, 0, 100, options); print_GetRecordsResponse(response); // Filter by a range std::string my_view3("my_view_3"); ``` -------------------------------- ### Install KAgent 7.2 on SUSE 15 (Latest Version) Source: https://docs.kinetica.com/7.2/admin/upgrade Installs the latest KAgent 7.2 package on SUSE 15 systems. It dynamically fetches the package name from the repository and installs it using zypper. Dependencies include wget and sudo privileges. ```shell KAGENT_REPO=https://repo.kinetica.com/yum/7.2/SUSE/15.3/x86_64 KAGENT_PKG=$(wget -q -O - ${KAGENT_REPO} | sed 's/<[^>]*>//g' | grep -o "kagent.*ga.*rpm " | sort -V | tail -1) wget ${KAGENT_REPO}/${KAGENT_PKG} sudo zypper install ./${KAGENT_PKG} ``` -------------------------------- ### Run UDF Initialization Script Source: https://docs.kinetica.com/7.2/udf/python/examples/github_examples/dist_model Executes the `setup_db.py` script, which is responsible for setting up the database environment for the distributed model UDF example. This typically involves creating tables and inserting initial data. ```bash python setup_db.py ``` -------------------------------- ### Install KAgent 7.2 on Ubuntu 22 (Latest Version) Source: https://docs.kinetica.com/7.2/admin/upgrade Installs the latest KAgent 7.2 package on Ubuntu 22 systems. It dynamically fetches the package name from the repository and installs it using apt. Dependencies include wget and sudo privileges. ```shell KAGENT_REPO=https://repo.kinetica.com/debian/7.2/Ubuntu/jammy/binary-amd64 KAGENT_PKG=$(wget -q -O - ${KAGENT_REPO} | sed 's/<[^>]*>//g' | grep -o "kagent.*ga.*deb " | sort -V | tail -1) wget ${KAGENT_REPO}/${KAGENT_PKG} sudo apt install ./${KAGENT_PKG} ``` -------------------------------- ### Run Kinetica Storm Connector Example (Unix) Source: https://docs.kinetica.com/7.2/connectors/storm_guide This command executes the Kinetica Storm connector example. It can be run in local mode (simulating Storm) or cluster mode (on a live Storm cluster). Optional arguments allow customization of record count, Kinetica URL, and IP prefix for multi-head ingestion. ```bash java -jar [--local] [--records=] [--url=] [--ipPrefix=] ``` ```bash java -jar storm-connector-1.0-jar-with-dependencies.jar --local --records=100000 --url=http://:9191 ``` -------------------------------- ### Install KAgent 7.2 on Ubuntu 20 (Latest Version) Source: https://docs.kinetica.com/7.2/admin/upgrade Installs the latest KAgent 7.2 package on Ubuntu 20 systems. It dynamically fetches the package name from the repository and installs it using apt. Dependencies include wget and sudo privileges. ```shell KAGENT_REPO=https://repo.kinetica.com/debian/7.2/Ubuntu/focal/binary-amd64 KAGENT_PKG=$(wget -q -O - ${KAGENT_REPO} | sed 's/<[^>]*>//g' | grep -o "kagent.*ga.*deb " | sort -V | tail -1) wget ${KAGENT_REPO}/${KAGENT_PKG} sudo apt install ./${KAGENT_PKG} ``` -------------------------------- ### Launch Tutorial Script - HTML/URL Source: https://docs.kinetica.com/7.2/aws/guides/js_guide Launches a Kinetica tutorial script by opening an HTML file in a browser. The URL parameter must include the Kinetica server URL, and optional username and password can be provided. This requires system admin permissions to run as it creates schema and database objects. ```html file:///path/to/tutorial/tutorial.html?url=[&user=&pass=] ``` -------------------------------- ### Install KAgent 7.2 on RHEL 8 (Latest Version) Source: https://docs.kinetica.com/7.2/admin/upgrade Installs the latest KAgent 7.2 package on RHEL 8 systems. It dynamically fetches the package name from the repository and installs it using yum. Dependencies include wget and sudo privileges. ```shell KAGENT_REPO=https://repo.kinetica.com/yum/7.2/CentOS/8/x86_64 KAGENT_PKG=$(wget -q -O - ${KAGENT_REPO} | sed 's/<[^>]*>//g' | grep -o "kagent.*ga.*rpm " | sort -V | tail -1) wget ${KAGENT_REPO}/${KAGENT_PKG} sudo yum install ./${KAGENT_PKG} ``` -------------------------------- ### Example Kinetica API Failure Response (Aggregation) Source: https://docs.kinetica.com/7.2/aws/feature_overview/get_records_json_feature_overview This is an example of a failure JSON response from the Kinetica API, indicating an error such as unsupported parameters for aggregation queries. ```json {\n "status": "ERROR",\n "message": "order_by not supported with aggregate(s) (E/Ec:162)"\n} ``` -------------------------------- ### Run Kinetica Storm Connector Example (Unix) Source: https://docs.kinetica.com/7.2/aws/connectors/storm_guide This command executes the Kinetica Storm Connector example. It allows for running in local simulation mode or on a live Storm cluster. Optional arguments control the number of records, Kinetica URL, and IP prefix for multi-head ingestion. ```bash java -jar [--local] [--records=] [--url=] [--ipPrefix=] ``` ```bash java -jar storm-connector-1.0-jar-with-dependencies.jar --local --records=100000 --url=https:////gpudb-0 ``` -------------------------------- ### POSITION Function Example Source: https://docs.kinetica.com/7.2/sql/query Finds the starting position (1-based) of a substring within a larger string. Returns 0 if the substring is not found or if the starting position is out of bounds. ```sql POSITION('world' IN 'hello world') ``` -------------------------------- ### Run Example Script Source: https://docs.kinetica.com/7.2/guides/solve_graph_seattle_multi_route This command shows how to execute the main Python script for the example. It allows for specifying the Kinetica URL, username, password, and optionally the directory containing data files. ```bash python solve_graph_seattle_multi_route.py [--url ] --username --password [--data_dir ] ``` -------------------------------- ### Start HA Service (Systemd) Source: https://docs.kinetica.com/7.2/ha/ha_configuration Starts the RabbitMQ service required for High Availability (HA) on Kinetica 7.2. This command must be run as the 'root' user on every node where the RabbitMQ service is installed. Ensure RabbitMQ is properly configured before starting. ```bash systemctl start gpudb-mq ``` -------------------------------- ### Create User Examples in SQL Source: https://docs.kinetica.com/7.2/sql/security Provides examples of how to create new internal user accounts with different configurations, including setting a password and assigning a resource group. It also shows how to create an external LDAP user by prepending the username with '@'. ```SQL CREATE USER jsmith IDENTIFIED BY 'secret' CREATE USER jsmith WITH PASSWORD 'secret' ``` ```SQL CREATE USER jsmith IDENTIFIED BY 'secret' WITH RESOURCE GROUP memory_over_execution ``` ```SQL CREATE USER "@jsmith" ``` -------------------------------- ### Run Graph Tutorial Script Source: https://docs.kinetica.com/7.2/aws/guides/graph_rest_guide This command executes the Kinetica graph tutorial script, which includes setting up and solving graph problems. It requires the Kinetica URL, username, and password as arguments. ```bash ./graphs_rest.sh ``` -------------------------------- ### Example Kinetica API Success Response (Aggregation) Source: https://docs.kinetica.com/7.2/aws/feature_overview/get_records_json_feature_overview This is an example of a successful JSON response from the Kinetica API after performing an aggregation. It shows the count of products for specific categories. ```json {\n "status": "OK",\n "data": {\n "records": [\n {\n "category": "Technology",\n "total_products": 2\n },\n {\n "category": "Office Supplies",\n "total_products": 3\n }\n ],\n "total_number_of_records": 2,\n "has_more_records": false\n }\n} ``` -------------------------------- ### Run Complete Isochrones Example Source: https://docs.kinetica.com/7.2/guides/isochrones Instructions and command to run the complete isochrones example script, including prerequisites and optional parameters. ```APIDOC ## Download & Run Included below is a complete example containing all the above requests, the data files, and output. * Isochrones script * DC shape data file * Python output To run the complete sample, ensure that: * the `isochrones.py` script is in the current directory * the `dc_shape.csv` file is in the current directory or use the `data_dir` parameter to specify the local directory containing it Then, run the following: ### Run Example ```bash python isochrones.py [--url ] --username --password [--data_dir ] ``` ``` -------------------------------- ### Install Specific KAgent 7.2 Version on SUSE 15 Source: https://docs.kinetica.com/7.2/admin/upgrade Installs a specific KAgent 7.2 RPM package on SUSE 15 systems. Requires manual specification of the package name and uses wget and zypper for installation. Ensure KAGENT_PKG variable is correctly set. ```shell KAGENT_REPO=https://repo.kinetica.com/yum/7.2/SUSE/15.3/x86_64 KAGENT_PKG=kagent-7.2.0.4.20240326024429.ga-0.x86_64.sles15.3.rpm wget ${KAGENT_REPO}/${KAGENT_PKG} sudo zypper install ./${KAGENT_PKG} ``` -------------------------------- ### Run Kinetica Python Tutorial Script Source: https://docs.kinetica.com/7.2/aws/guides/python_guide This snippet shows how to execute the `python_tutorial.py` script. It requires the script and a data file to be in the current directory or a specified data directory. Optional parameters for Kinetica URL, username, and password can be provided. ```bash python python_tutorial.py [--url ] --username --password [--data_dir ] ``` -------------------------------- ### Install Specific KAgent 7.2 Version on Ubuntu 22 Source: https://docs.kinetica.com/7.2/admin/upgrade Installs a specific KAgent 7.2 deb package on Ubuntu 22 systems. Requires manual specification of the package name and uses wget and apt for installation. Ensure KAGENT_PKG variable is correctly set. ```shell KAGENT_REPO=https://repo.kinetica.com/debian/7.2/Ubuntu/jammy/binary-amd64 KAGENT_PKG=kagent_7.2.0.4.20240326024429.ga-0_amd64.ubuntu22.04.deb wget ${KAGENT_REPO}/${KAGENT_PKG} sudo apt install ./${KAGENT_PKG} ``` -------------------------------- ### Install Reveal SDK via NPM Source: https://docs.kinetica.com/7.2/bi/reveal/sdk NPM command to globally install the Reveal SDK from a specified path. This makes the SDK tools available system-wide. ```bash npm install -g /opt/gpudb/connectors/reveal/sdk ``` -------------------------------- ### Install Specific KAgent 7.2 Version on Ubuntu 20 Source: https://docs.kinetica.com/7.2/admin/upgrade Installs a specific KAgent 7.2 deb package on Ubuntu 20 systems. Requires manual specification of the package name and uses wget and apt for installation. Ensure KAGENT_PKG variable is correctly set. ```shell KAGENT_REPO=https://repo.kinetica.com/debian/7.2/Ubuntu/focal/binary-amd64 KAGENT_PKG=kagent_7.2.0.4.20240326024429.ga-0_amd64.ubuntu20.04.deb wget ${KAGENT_REPO}/${KAGENT_PKG} sudo apt install ./${KAGENT_PKG} ``` -------------------------------- ### Install Specific KAgent 7.2 Version on RHEL 8 Source: https://docs.kinetica.com/7.2/admin/upgrade Installs a specific KAgent 7.2 RPM package on RHEL 8 systems. Requires manual specification of the package name and uses wget and yum for installation. Ensure KAGENT_PKG variable is correctly set. ```shell KAGENT_REPO=https://repo.kinetica.com/yum/7.2/CentOS/8/x86_64 KAGENT_PKG=kagent-7.2.0.4.20240326024429.ga-0.x86_64.el8.rpm wget ${KAGENT_REPO}/${KAGENT_PKG} sudo yum install ./${KAGENT_PKG} ``` -------------------------------- ### List Built RKinetica Package Source: https://docs.kinetica.com/7.2/connectors/r_guide Lists files in the current directory that match the RKinetica package naming convention. This is used to verify the tar.gz file was successfully created after building. ```bash ls RKinetica* ```