I believe there is a lot of interest into mixing futher Redis and SQLite.
I want to create an abstraction called Projection that will contains the best of both Redis AND SQL.
We project on a table.
Given the table
CREATE TABLE user VALUES(
ID PRIMARY KEY,
username TEXT,
points INT)
We can use that table as a standard SQL table but also project its values on the redis key space.
We could access the values of username or points using the following syntax:
REDISQL.GET user:ID:username or REDISQL.GET user:ID:points
Then we could also set values using a similar syntax:
REDISQL.SET user:ID:username "siscia" or REDISQL.SET user:ID:points 12 this changes will be reported into the SQL table.
> SELECT points FROM user WHERE username = 'siscia';
12
And of course it will work the other way around.
REDISQL.EXEC DB "UPDATE user SET points = 24 WHERE username = 'siscia' and ID = 1234"
> OK
REDISQL.GET username:1234:points
> 24
The syntax that for now seems to make sense for me to create a projection is something like:
after this command the SQL table and the redis key space should appear in sync.
Then it would be possible to remove the projection with
REDISQL.REMOVE_PROJECTION table
Clearly this means that tables with the same name in different databases cannot be projected at the same time.
This could be easily fixed adding as prefix, the name of the database, but I believe it will bring more problem than benefits.
I believe there is a lot of interest into mixing futher Redis and SQLite.
I want to create an abstraction called
Projectionthat will contains the best of both Redis AND SQL.We project on a table.
Given the table
We can use that table as a standard SQL table but also project its values on the redis key space.
We could access the values of username or points using the following syntax:
REDISQL.GET user:ID:usernameorREDISQL.GET user:ID:pointsThen we could also set values using a similar syntax:
REDISQL.SET user:ID:username "siscia"orREDISQL.SET user:ID:points 12this changes will be reported into the SQL table.And of course it will work the other way around.
The syntax that for now seems to make sense for me to create a projection is something like:
after this command the SQL table and the redis key space should appear in sync.
Then it would be possible to remove the projection with
Clearly this means that tables with the same name in different databases cannot be projected at the same time.
This could be easily fixed adding as prefix, the name of the database, but I believe it will bring more problem than benefits.