GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Products
  • Platform
  • Management Center
  • Operator
  • Cloud
  • CLC
  • Tutorials
  • 6.0-SNAPSHOT
  • 5.6
  • 5.5
  • 5.4
  • 5.3
  • Archives
  • Try Hazelcast

This view

  • Original page
  • New address

GeezerVison is showing docs.hazelcast.com — SQL | Hazelcast Documentation

Version: 5.7

You can use SQL to query data in maps, Kafka topics, or a variety of file systems. Results can be sent directly to the client or inserted into maps or Kafka topics.

tip

For a hands-on introduction to SQL, see Get started with SQL over maps.

Before you Begin​

To use the SQL service, the Jet engine must be enabled on the cluster. For information about how to enable the Jet engine, see Securing Jobs.

Connecting to the SQL Service​

You can connect to the SQL service of a Hazelcast member using one of the following options:

  • SQL shell or Management Center: For fast prototyping.
  • JDBC driver or the Java client: For Java applications.
  • Node.js client.
  • Python client.
  • Go client.
  • C# client.
note

You cannot run SQL queries on lite members. This limitation will be removed in future releases.

Using the SQL Shell​

The easiest way to run SQL queries on a cluster is to connect to the SQL shell.

To connect to the SQL shell, run the hz-cli sql command of your member's built-in CLI.

  • Binary
  • Docker
Mac and Linux
shell
bin/hz-cli sql
Windows
shell
bin\hz-cli.bat sql

Replace the <cluster-name> placeholder with the name of your cluster and the <address> placeholder with your member's IP address.

shell
docker run --network hazelcast-network -it --rm hazelcast/hazelcast:5.7.0 hz-cli --targets <cluster-name>@<address> sql

Mappings​

Before you can query data in SQL, you need to create a mapping to the data source. Mappings store essential metadata about the source's data model, data access patterns, and serialization formats so that the SQL service can connect to the data source and query it.

Currently, you can create mappings for the following data sources:

  • Hazelcast maps
  • Kafka topics
  • File systems

SQL Metadata​

To avoid the loss of SQL mappings, data connections, or views after a cluster restart, you can enable the persistence of SQL metadata.

Case Sensitivity​

Mapping names and field names are case-sensitive.

For example, you can access an employee map as employee but not as Employee.

Keywords or built-in function names are case-insensitive.

Permissions and Security​

Enterprise EditionThis feature requires Hazelcast Enterprise, a licensed edition of the Hazelcast Platform.

If security is enabled, you can set permissions for the following:

  • Connectors (mappings)
  • Some SQL statements
note

When you run a query, Hazelcast runs it as a job. As a result, clients with the read permission for jobs can see the SQL query text and the arguments. See Job Permissions.

Supported Statements​

Hazelcast supports a subset of standard ANSI SQL statements as well as some custom ones for creating jobs, mappings, and streaming queries.

For a list of supported statements, see SQL Statements.

Limitations​

SQL has the following limitations. We plan to remove these limitations in future releases.

  • The only supported Hazelcast data structure is map.

    You cannot query other data structures such as replicated maps.

  • Although you can create bitmap indexes in SQL, SQL queries do not leverage those indexes to improve query performance.

  • You cannot run SQL queries on lite members. This limitation will be removed in future releases.

SQL Jobs​

When a SQL statement is submitted for execution, the SQL service parses and optimizes it. The result is an execution plan in the form of a job that is cached and reused by subsequent executions of the same statement.

For details about how Hazelcast models and executes jobs, see Jet: How Hazelcast Models and Executes Jobs.

Next Steps​

  • Get started with SQL over maps.
  • Get started with SQL over Kafka.
  • Get started with SQL over files.

Explore the SQL reference docs.

  • Before you Begin
  • Connecting to the SQL Service
    • Using the SQL Shell
  • Mappings
  • SQL Metadata
  • Case Sensitivity
  • Permissions and Security
  • Supported Statements
  • Limitations
  • SQL Jobs
  • Next Steps
Edit this page
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.