Search code examples
ignite

SQL Query in Apache Ignite Cache


I just started using Apache Ignite as an in-memory cache for my web application. I created a Cache and added a few key/value pairs. I didn't create any table or anything. I used the name "Content" to create the cache. I can access the data using the API get/put operations, but I was wondering whether I can use SQL to get the data. I tried to execute a few sentences but I'm not sure what table name should I use. I tried using "Content" (the name of my cache) but I get "Table does not exist" error.

"SELECT * FROM Content"

Any ideas whether this is possible or do I need to explicitly create a Table? Would that be different than creating a cache?


Solution

  • Yes, you need to configure SQL schema in order to run SQL queries against a cache: https://apacheignite-sql.readme.io/docs/schema-and-indexes

    Or you can create tables using DDL (underlying caches will be created automatically in this case): https://apacheignite-sql.readme.io/docs/ddl