blob: 1967fc70acb67d924e59520f218d18fdca59b2a2 [file] [log] [blame]
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
= Table Views
Apache Ignite 3.0 Alpha introduces the key-value API to access cached data via built-in table views.
[NOTE]
====
Please note that the key-value API requires using a case sensitive collation for the database object names and parsing a string argument of the name that is passed through the API.
See the examples below:
* String values:
+
[source,text]
----
// Creates PUBLIC.MYTABLE.
CREATE TABLE MyTable (id INT, val INT);
// Returns PUBLIC.MYTABLE.
ignite.tables().table("public.mytable"); ->
// Creates PUBLIC.MyTable.
CREATE TABLE \"MyTable\" (id INT, val INT); ->
// Returns PUBLIC.MyTable.
ignite.tables().table("public.\"MyTable\""); ->
----
* Tuples or columns:
+
[source,text]
----
// Creates PUBLIC.MYTABLE (ID, Id, VAL).
CREATE TABLE MyTable (id INT, \"Id\" INT, val INT);
Tuple tuple = ...
// Returns ID column's value.
tuple.value("id")
// Returns ID column's value.
tuple.value("Id")
// Returns Id column's value.
tuple.value("\"Id\"")
----
====
== Key-Value View
This table view maps key objects to value objects. The view cannot contain duplicate key objects; each key object can map to at most one value object.
=== Running an Example
Examples are shipped as a separate Maven project, which is located in the `examples` folder. `KeyValueViewExample` demonstrates the usage of the key-value view.
To start running `KeyValueViewExample`, please refer to its link:https://github.com/apache/ignite-3/blob/main/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewExample.java[JavaDoc,window=_blank] for instructions.
== Record View
This table view provides methods to access table records.
=== Running an Example
Examples are shipped as a separate Maven project, which is located in the `examples` folder. `RecordViewExample` demonstrates the usage of the record view.
To start running `RecordViewExample`, please refer to its link:https://github.com/apache/ignite-3/blob/main/examples/src/main/java/org/apache/ignite/example/table/RecordViewExample.java[JavaDoc,window=_blank] for instructions.
== Record Binary View
NOTE: This is a table view implementation for the binary objects.
You can use binary objects to access the cached data. The benefit of using binary objects is that you avoid deserialization, which is important if you access objects from a server node that does not have the objects class representation.
For more information on record binary view, please see the following link:https://github.com/apache/ignite-3/blob/main/modules/table/src/main/java/org/apache/ignite/internal/table/RecordBinaryViewImpl.java[implementation example,window=_blank].