🐈
zeeSQL
  • zeeSQL, SQL and search by value for Redis. Fast, Simple and Reliable.
  • How to
    • How to choose between QUERY and EXEC
    • know-what-secondary-indexes-are defined
    • How to load zeeSQL in Redis
    • How to check if an index is used in zeeSQL and SQLite
    • know-what-secondary-indexes-are defined
    • create-an-index
    • create-a-view
    • create-a-secondary-index
    • How to create a trigger
    • quickly-ingest-data
    • How to copy a database
    • get-help
    • work-with-dates
    • using-full-text-search
    • work-with-json
    • How to create a new database in zeeSQL
    • How to create a new table in zeeSQL
    • know-what-tables-are-defined
    • know-what-databases-are-defined
    • works-with-boolean
    • How to get zeeSQL
    • How to get JSON output
    • add-multiple-rows
  • blog
    • node
      • Using RediSQL with Node.js
    • JSON on Redis via RediSQL, SQL steroids for Redis
    • golang
      • Using RediSQL with Go(lang)
    • Doubling the performances of RediSQL, SQL steroids for Redis.
    • zeeSQL now runs on SQLite 3.35
    • Query Redis on two attributes
    • RediSQL for analytics
    • Copying RediSQL databases
    • Release 0.9.0 of RediSQL, SQL steroids for Redis
    • Release 0.8.0 of RediSQL, SQL steroids for Redis
    • Release 0.7.0 of RediSQL, SQL steroids for Redis
    • JSON on Redis via RediSQL, SQL steroids for Redis
    • Release 0.6.0 of RediSQL, SQL steroids for Redis
    • python
      • using-redisql-with-python
    • Release 0.5.0 of RediSQL, SQL steroids for Redis
  • References
  • zeeSQL commits to backward compatibility
  • zeeSQL, a solid product for busy developer
  • zeeSQL and secondary indexes, how to search Redis key by value
  • Tutorial
  • Pricing for zeeSQL
  • Why you should migrate from RediSQL to zeeSQL
  • FAQs
  • Motivation
Powered by GitBook
On this page
  • Importing an external database
  • About zeeSQL

Was this helpful?

  1. How to

How to create a new database in zeeSQL

Previouswork-with-jsonNextHow to create a new table in zeeSQL

Last updated 4 years ago

Was this helpful?

To start using zeeSQL you need to create a database.

In zeeSQL you can have as many databases as necessary.

Each database you create in zeeSQL is an SQLite database, it can either be an in-memory database or a file-backed database.

Each database is associate with a Redis key.

Delete the key, and the database is deleted. If the database is backed by a file, then the file is closed, but it is not deleted.

To create a database, you can use the command

127.0.0.1:6379> ZEESQL.CREATE_DB DB
1) 1) "OK"

In this way a new in-memory database is created, it is associated with the DB key in Redis.

In-memory databases will always be created empty in zeeSQL.

To create a database-backed by a file, you need to pass the PATH flag.

127.0.0.1:6379> ZEESQL.CREATE_DB FILE_DB PATH file.sqlite
1) 1) "OK"

The FILE_DB database, will be associate with an SQLite database stored in disk, in the file file.sqlite.

Please note that databases stored in disk have different performances than the databases stored in memory. Usually slower.

Importing an external database

Sometimes you may want to import some data from some other source.

zeeSQL allows you to load any SQLite database.

Suppose you already have an SQLite database that contains your users, and that you saved it in users.sqlite.

To import that database inside zeeSQL you only need to:

127.0.0.1:6379> ZEESQL.CREATE_DB USERS PATH users.sqlite
1) 1) "OK"
127.0.0.1:6379> ZEESQL.EXEC USERS COMMAND "select * from users"
1) 1) "RESULT"
2) 1) "id"
   2) "username"
   3) "score"
3) 1) "INT"
   2) "TEXT"
   3) "INT"
4) 1) (integer) 100
   2) "joh"
   3) (integer) 3
5) 1) (integer) 101
   2) "mary"
   3) (integer) 7
6) 1) (integer) 102
   2) "brand"
   3) (integer) 4

About zeeSQL

zeeSQL is a Redis Module that provides SQL capabilities to Redis. It allows the creation and management of several SQL databases, each one independent from the other. Moreover, zeeSQL provides out-of-the-box capabilities, allowing fast and easy search by value in Redis.

secondary indexes
ZEESQL.CREATE_DB