Skip to content
This repository was archived by the owner on Jul 11, 2021. It is now read-only.
This repository was archived by the owner on Jul 11, 2021. It is now read-only.

Projection, please help #12

@siscia

Description

@siscia

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:

REDISQL.PROJECT DB table

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions