<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Snippets on Kinetica Docs</title><link>/7.2/snippets/</link><description>Recent content in Snippets on Kinetica Docs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/7.2/snippets/index.xml" rel="self" type="application/rss+xml"/><item><title>Exporting Data</title><link>/7.2/snippets/export-data/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/export-data/</guid><description>EXPORT ... INTO Sources (Table/Query) Data Sinks (File/Table/DML) Delimited Text Options Parquet Files Naming Options Sizing Options EXPORT ... INTO Sources (Table/Query) Table Query Table 1 2 EXPORT TABLE employee INTO FILE PATH &amp;#39;/export/employee.csv&amp;#39; Query 1 2 3 4 5 6 7 EXPORT QUERY ( SELECT id, manager_id, first_name, last_name, salary, hire_date FROM employee WHERE dept_id = 2 ) INTO FILE PATH &amp;#39;/export/employee_dept2.csv&amp;#39; Data Sinks (File/Table/DML) File Table (via JDBC) DML (via JDBC) Init Options (via JDBC) File 1 2 3 EXPORT TABLE employee INTO FILE PATH &amp;#39;/data/employee.</description></item><item><title>Geohashing</title><link>/7.2/snippets/geohash/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/geohash/</guid><description>Enrich a Point-Based Table with Geohashes Create an Aggregated View with WKT Geometries Enrich a Point-Based Table with Geohashes Create a geohash for pickup locations in the NYC taxi data set.
Lat/Lon-Based Table WKT-Based Table Lat/Lon-Based Table 1 2 3 4 5 6 7 8 CREATE OR REPLACE TABLE example_geospatial.nyctaxi_geohash AS ( SELECT pickup_latitude, pickup_longitude, STXY_GEOHASH(pickup_longitude, pickup_latitude, 6) AS geohash FROM example_geospatial.nyctaxi_xy ) WKT-Based Table 1 2 3 4 5 6 7 CREATE OR REPLACE TABLE example_geospatial.</description></item><item><title>H3 Geohashing</title><link>/7.2/snippets/geohash-h3/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/geohash-h3/</guid><description>Enrich a Point-Based Table with H3 Indexes Create an Aggregated View with WKT Geometries Enrich a Point-Based Table with H3 Indexes Create an H3 index for pickup locations in the NYC taxi data set.
Lat/Lon-Based Table WKT-Based Table Lat/Lon-Based Table 1 2 3 4 5 6 7 8 CREATE OR REPLACE TABLE example_geospatial.nyctaxi_h3 AS ( SELECT pickup_latitude, pickup_longitude, H3_XYTOCELL(pickup_longitude, pickup_latitude, 8) AS h3_index FROM example_geospatial.nyctaxi_xy ) WKT-Based Table 1 2 3 4 5 6 7 CREATE OR REPLACE TABLE example_geospatial.</description></item><item><title>JSON Egress</title><link>/7.2/snippets/json-egress/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/json-egress/</guid><description>Simple Egress Egress with Parameters Egress with Aggregation The /get/records/json REST endpoint can be called to retrieve data in JSON form directly from the database.
See Overview for call details and Responses for return values.
Simple Egress cURL Python Java JavaScript Node.js cURL 1 2 3 4 5 6 7 8 9 10 KINETICA_URL=http://localhost:9191 USERNAME=auser PASSWORD=apassword TABLE_NAME=product # Quote the URL when passing multiple options, or any &amp;amp; will stop the URL # parsing and run the URL parsed up to that point as a background job curl -sS ${KINETICA_URL}/get/records/json?</description></item><item><title>JSON Ingest</title><link>/7.2/snippets/json-ingest/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/json-ingest/</guid><description>Basic Ingest from File Ingest from File with Options Ingest from JSON String The /insert/records/json REST endpoint can be called directly, or with a convenient wrapper in the Java API.
See Overview for call details and Responses for return values.
Basic Ingest from File cURL Python Java Java (Distributed Ingest) JavaScript Node.js cURL 1 2 3 4 5 6 7 8 9 10 KINETICA_URL=http://localhost:9191 USERNAME=auser PASSWORD=apassword TABLE_NAME=product JSON_FILE_NAME=products.json curl -sS -X POST --header &amp;#34;Content-Type: application/json&amp;#34; \ --user &amp;#34;${USERNAME}:${PASSWORD}&amp;#34; \ -d @${JSON_FILE_NAME} \ ${KINETICA_URL}/insert/records/json?</description></item><item><title>Loading Data</title><link>/7.2/snippets/load-data/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/load-data/</guid><description>LOAD INTO Single &amp;amp; Multiple KiFS Files Data Sources File/Queue-Based Query-Based File Types Delimited Text Files JSON/GeoJSON Files Parquet Files Shapefiles Avro Files Primary/Shard Keys Query Partitioning Options Other Options External Tables LOAD INTO Single &amp;amp; Multiple KiFS Files Single File Multiple Files by List Single File 1 2 LOAD DATA INTO example.product FROM FILE PATHS &amp;#39;kifs://data/products.csv&amp;#39; Multiple Files by List 1 2 LOAD DATA INTO example.product FROM FILE PATHS &amp;#39;kifs://data/products.</description></item><item><title>Vector Search</title><link>/7.2/snippets/vector/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/vector/</guid><description>Creating a Table Vector Column without Normalization Vector Column with Normalization Inserting Vector Data Retrieving Vector Data Indexing Vector Data CAGRA Vector Index HNSW Vector Index Searching Vector Data Vector Search by Operator Vector Search by Function Creating a Table A vector column can optionally be configured to normalize the vector data inserted into it, giving each vector a magnitude (L2 norm) of 1. This can improve the performance of some vector operations with minimal overhead.</description></item><item><title>Creating Credentials</title><link>/7.2/snippets/create-credentials/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/create-credentials/</guid><description>Azure Google Cloud Storage HDFS JDBC Kafka (Apache) Kafka (Confluent) Remote Repository S3 (Amazon) Several authentication schemes across multiple providers are supported. For a detailed overview of all of the provider-specific options, see the SQL documentation.
Azure Password SAS Token Active Directory Password 1 2 3 4 CREATE CREDENTIAL azure_cred TYPE = &amp;#39;azure_storage_key&amp;#39;, IDENTITY = &amp;#39;sampleacc&amp;#39;, SECRET = &amp;#39;foobaz123&amp;#39; SAS Token 1 2 3 4 CREATE CREDENTIAL azure_cred TYPE = &amp;#39;azure_sas&amp;#39;, IDENTITY = &amp;#39;sampleacc&amp;#39;, SECRET = &amp;#39;sv=2015-07-08&amp;amp;sr=b&amp;amp;sig=39Up0JzHkxhUlhFEjEH9673DJxe7w6.</description></item><item><title>Creating Data Sinks</title><link>/7.2/snippets/create-data-sinks/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/create-data-sinks/</guid><description>Azure BLOB Google Cloud Storage HDFS JDBC Kafka Local Table S3 Webhook Several authentication schemes across multiple consumers are supported. For a detailed overview of all of the consumer-specific options, see the SQL documentation.
Note
Creating an authenticated data sink may require creating a corresponding credential object to store the authentication information and then referencing that object when creating the data sink. See Creating Credentials for examples.
Azure BLOB Credential Managed Credentials Credential 1 2 3 4 5 6 7 CREATE DATA SINK azure_dsink LOCATION = &amp;#39;AZURE&amp;#39; WITH OPTIONS ( CREDENTIAL = &amp;#39;azure_cred&amp;#39;, CONTAINER NAME = &amp;#39;samplecontainer&amp;#39; ) Managed Credentials 1 2 3 4 5 6 7 8 9 CREATE DATA SINK azure_dsink LOCATION = &amp;#39;AZURE&amp;#39; WITH OPTIONS ( USE_MANAGED_CREDENTIALS = true, STORAGE ACCOUNT NAME = &amp;#39;sampleacc&amp;#39;, CONTAINER NAME = &amp;#39;samplecontainer&amp;#39;, TENANT ID = &amp;#39;x0xxx10-00x0-0x01-0xxx-x0x0x01xx100&amp;#39; ) Google Cloud Storage Credential Managed Credentials Public (No Auth) JSON Key Credential 1 2 3 4 5 6 7 CREATE DATA SINK gcs_dsink LOCATION = &amp;#39;GCS&amp;#39; WITH OPTIONS ( CREDENTIAL = &amp;#39;gcs_cred&amp;#39;, GCS_BUCKET_NAME = &amp;#39;gcs-private&amp;#39; ) Managed Credentials 1 2 3 4 5 6 7 CREATE DATA SINK gcs_dsink LOCATION = &amp;#39;GCS&amp;#39; WITH OPTIONS ( USE_MANAGED_CREDENTIALS = true, GCS_BUCKET_NAME = &amp;#39;gcs-private&amp;#39; ) Public (No Auth) 1 2 3 CREATE DATA SINK gcs_dsink LOCATION = &amp;#39;GCS&amp;#39; WITH OPTIONS (GCS_BUCKET_NAME = &amp;#39;gcs-public&amp;#39;) JSON Key 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 CREATE DATA SINK gcs_dsink LOCATION = &amp;#39;GCS&amp;#39; WITH OPTIONS ( GCS_SERVICE_ACCOUNT_KEYS = &amp;#39; { &amp;#34;type&amp;#34;: &amp;#34;service_account&amp;#34;, &amp;#34;project_id&amp;#34;: &amp;#34;auser&amp;#34;, &amp;#34;private_key_id&amp;#34;: &amp;#34;abcdef1234567890&amp;#34;, &amp;#34;private_key&amp;#34;: &amp;#34;-----BEGIN PRIVATE KEY-----\nABCDEFG=\n-----END PRIVATE KEY-----\n&amp;#34;, &amp;#34;client_email&amp;#34;: &amp;#34;auser@auser.</description></item><item><title>Creating Data Sources</title><link>/7.2/snippets/create-data-sources/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/create-data-sources/</guid><description>Azure BLOB Google Cloud Storage HDFS JDBC Kafka (Apache) Kafka (Confluent) S3 Several authentication schemes across multiple providers are supported. For a detailed overview of all of the provider-specific options, see the SQL documentation.
Note
Creating an authenticated data source may require creating a corresponding credential object to store the authentication information and then referencing that object when creating the data source. See Creating Credentials for examples.
Azure BLOB Credential Public (No Auth) Managed Credentials Password SAS Token Active Directory Credential 1 2 3 4 5 6 7 CREATE DATA SOURCE azure_ds LOCATION = &amp;#39;AZURE&amp;#39; WITH OPTIONS ( CREDENTIAL = &amp;#39;azure_cred&amp;#39;, CONTAINER NAME = &amp;#39;samplecontainer&amp;#39; ) Public (No Auth) 1 2 3 4 5 6 7 CREATE DATA SOURCE azure_ds LOCATION = &amp;#39;AZURE&amp;#39; USER = &amp;#39;sampleacc&amp;#39; WITH OPTIONS ( CONTAINER NAME = &amp;#39;samplecontainer&amp;#39; ) Managed Credentials 1 2 3 4 5 6 7 8 9 10 CREATE DATA SOURCE azure_ds LOCATION = &amp;#39;AZURE&amp;#39; USER = &amp;#39;sampleacc&amp;#39; WITH OPTIONS ( USE_MANAGED_CREDENTIALS = true, STORAGE ACCOUNT NAME = &amp;#39;sampelacc&amp;#39;, CONTAINER NAME = &amp;#39;samplecontainer&amp;#39;, TENANT ID = &amp;#39;x0xxx10-00x0-0x01-0xxx-x0x0x01xx100&amp;#39; ) Password 1 2 3 4 5 6 7 8 CREATE DATA SOURCE azure_ds LOCATION = &amp;#39;AZURE&amp;#39; USER = &amp;#39;sampleacc&amp;#39; PASSWORD = &amp;#39;foobaz123&amp;#39; WITH OPTIONS ( CONTAINER NAME = &amp;#39;samplecontainer&amp;#39; ) SAS Token 1 2 3 4 5 6 7 8 CREATE DATA SOURCE azure_ds LOCATION = &amp;#39;AZURE&amp;#39; USER = &amp;#39;sampleacc&amp;#39; WITH OPTIONS ( CONTAINER NAME = &amp;#39;samplecontainer&amp;#39;, SAS TOKEN = &amp;#39;sv=2015-07-08&amp;amp;sr=b&amp;amp;sig=39Up0JzHkxhUlhFEjEH9673DJxe7w6clRCg0V6lCgSo%3D&amp;amp;se=2016-10-18T21%A51%A337Z&amp;amp;sp=rcw&amp;#39; ) Active Directory 1 2 3 4 5 6 7 8 9 10 CREATE DATA SOURCE azure_ds LOCATION = &amp;#39;AZURE&amp;#39; USER = &amp;#39;jdoe&amp;#39; PASSWORD = &amp;#39;foobaz123&amp;#39; WITH OPTIONS ( STORAGE ACCOUNT NAME = &amp;#39;sampelacc&amp;#39;, CONTAINER NAME = &amp;#39;samplecontainer&amp;#39;, TENANT ID = &amp;#39;x0xxx10-00x0-0x01-0xxx-x0x0x01xx100&amp;#39; ) Google Cloud Storage Credential Managed Credentials Public (No Auth) User ID &amp;amp; Key JSON Key Credential 1 2 3 4 5 6 7 CREATE DATA SOURCE gcs_ds LOCATION = &amp;#39;GCS&amp;#39; WITH OPTIONS ( CREDENTIAL = &amp;#39;gcs_cred&amp;#39;, GCS_BUCKET_NAME = &amp;#39;gcs-public&amp;#39; ) Managed Credentials 1 2 3 4 5 6 7 CREATE DATA SOURCE gcs_ds LOCATION = &amp;#39;GCS&amp;#39; WITH OPTIONS ( USE_MANAGED_CREDENTIALS = true, GCS_BUCKET_NAME = &amp;#39;gcs-public&amp;#39; ) Public (No Auth) 1 2 3 4 5 6 CREATE DATA SOURCE gcs_ds LOCATION = &amp;#39;GCS&amp;#39; WITH OPTIONS ( GCS_BUCKET_NAME = &amp;#39;gcs-public&amp;#39; ) User ID &amp;amp; Key 1 2 3 4 5 6 7 8 CREATE DATA SOURCE gcs_ds LOCATION = &amp;#39;GCS&amp;#39; USER = &amp;#39;auser@auser.</description></item><item><title>Creating Streams</title><link>/7.2/snippets/create-streams/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/create-streams/</guid><description>Monitor Target Refresh Event Options Several authentication schemes across multiple consumers are supported. For a detailed overview of all of the consumer-specific options, see the SQL documentation.
Monitor Target Data Sink Kafka (No Auth) Local Table HTTP HTTPS Data Sink 1 2 CREATE STREAM kin_stream ON example.order_stream WITH OPTIONS (DATASINK_NAME = &amp;#39;kin_dsink&amp;#39;) Kafka (No Auth) 1 2 3 4 5 6 CREATE STREAM kin_stream ON example.order_stream WITH OPTIONS ( DESTINATION = &amp;#39;kafka://kafka-test:9092&amp;#39;, KAFKA_TOPIC_NAME = &amp;#39;kafka-test&amp;#39; ) Local Table 1 2 CREATE STREAM kin_stream ON example.</description></item><item><title>Creating Tables</title><link>/7.2/snippets/create-tables/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/create-tables/</guid><description>Column Types Column Features Keys Indexes Collision Options (Table Exists) Distribution Properties Partitions Tier Strategy For the full table creation syntax, see CREATE TABLE.
Column Types For the full set of column types, see Column Types.
Numeric Text (Simple) Text (Complex) Date/Time Binary Geospatial Array Numeric 1 2 3 4 5 6 7 8 9 10 11 12 CREATE TABLE column_types_numeric ( b BOOLEAN, -- Native &amp;#34;boolean&amp;#34; type ti TINYINT, -- Native &amp;#34;int8&amp;#34; type si SMALLINT, -- Native &amp;#34;int16&amp;#34; type i INT, -- Native &amp;#34;integer&amp;#34; type bi BIGINT, -- Native &amp;#34;long&amp;#34; type ub UNSIGNED BIGINT, -- Native &amp;#34;ulong&amp;#34; type r REAL, -- Native &amp;#34;float&amp;#34; type d DOUBLE, -- Native &amp;#34;double&amp;#34; type dc DECIMAL(18, 4) -- Native &amp;#34;decimal&amp;#34; type ) Text (Simple) 1 2 3 4 5 6 7 CREATE TABLE column_types_text_simple ( c_min VARCHAR(1), -- Native &amp;#34;char1&amp;#34; type c_max VARCHAR(256), -- Native &amp;#34;char256&amp;#34; type s VARCHAR, -- Native &amp;#34;string&amp;#34; type sn VARCHAR(512) -- Native &amp;#34;string&amp;#34; type ) Text (Complex) 1 2 3 4 5 6 CREATE TABLE column_types_text_complex ( ip IPV4, -- Native &amp;#34;ipv4&amp;#34; column property on &amp;#34;string&amp;#34; type ui UUID, -- Native &amp;#34;uuid&amp;#34; type j JSON -- Native &amp;#34;json&amp;#34; type ) Date/Time 1 2 3 4 5 6 7 CREATE TABLE column_types_date_time ( td DATE, -- Native &amp;#34;date&amp;#34; type dt DATETIME, -- Native &amp;#34;datetime&amp;#34; type tt TIME, -- Native &amp;#34;time&amp;#34; type ts TIMESTAMP -- Native &amp;#34;timestamp&amp;#34; type ) Binary 1 2 3 4 CREATE TABLE column_types_binary ( b BLOB -- Native &amp;#34;bytes&amp;#34; type ) Geospatial 1 2 3 4 5 CREATE TABLE column_types_geospatial ( geo GEOMETRY, -- Native &amp;#34;wkt&amp;#34; subtype of &amp;#34;string&amp;#34; type bw BLOB(WKT) -- Native &amp;#34;wkt&amp;#34; subtype of &amp;#34;bytes&amp;#34; type ) Array 1 2 3 4 5 6 7 8 9 10 11 CREATE TABLE column_types_array ( ab BOOLEAN[3], -- Native &amp;#34;array(boolean, 3)&amp;#34; subtype of &amp;#34;string&amp;#34; type ai INT[3], -- Native &amp;#34;array(int, 3)&amp;#34; subtype of &amp;#34;string&amp;#34; type abi BIGINT[3], -- Native &amp;#34;array(long, 3)&amp;#34; subtype of &amp;#34;string&amp;#34; type aubi UNSIGNED BIGINT[3], -- Native &amp;#34;array(ulong, 3)&amp;#34; subtype of &amp;#34;string&amp;#34; type avec VECTOR(3), -- Native &amp;#34;vector(3)&amp;#34; type ar REAL[3], -- Native &amp;#34;array(float, 3)&amp;#34; subtype of &amp;#34;string&amp;#34; type ad DOUBLE[3], -- Native &amp;#34;array(double, 3)&amp;#34; subtype of &amp;#34;string&amp;#34; type avar VARCHAR[3] -- Native &amp;#34;array(string, 3)&amp;#34; subtype of &amp;#34;string&amp;#34; type ) Column Features Any column type can have the nullability modified or have a comment applied.</description></item><item><title>Useful Catalog Queries</title><link>/7.2/snippets/virtual-catalog-queries/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/7.2/snippets/virtual-catalog-queries/</guid><description>Table Resource Usage Table RAM Usage Table Disk Usage Materialized View Dependencies Specified Materialized View Dependencies All Materialized View Dependencies 10 Most Recent SQL Queries Import/Export Jobs with Errors in the Past Hour Users with Row/Column Security Restrictions Role Assignments The catalog tables allow for some useful information to be extracted from the database. See Virtual Catalogs for a complete listing.
Table Resource Usage Table RAM Usage Kinetica Catalog 1 2 3 4 5 6 7 8 SELECT IF(GROUPING(source_rank) = 1,&amp;#39;Total&amp;#39;,STRING(source_rank)) AS &amp;#34;Rank&amp;#34;, SUM(size) AS &amp;#34;Bytes&amp;#34; FROM ki_catalog.</description></item></channel></rss>