6 ms·
Have you thought of ways to implement queries involving LIKE operations ? I worked on a similar project some time ago and one of the limitation for such impleme
by aalekhN 10y ago
Have you thought of ways to implement queries involving LIKE operations ? I worked on a similar project some time ago and one of the limitation for such implementation I encountered was use of glob-style patterns in redis.
- siscia 10y agoDidn't quite get your question. SQLite does implement the LIKE operator. From the module: 127.0.0.1:6379> REDISQL.EXEC "CREATE TABLE text_search(t TEXT);" OK 127.0.0.1:6379> REDISQL.EXEC "INSERT INTO text_search VALUES('hello');" OK 127.0.0.1:6379> REDISQL.EXEC "INSERT INTO text_search VALUES('banana');" OK 127.0.0.1:6379> REDISQL.EXEC "INSERT INTO text_search VALUES('apple');" OK 127.0.0.1:6379> 127.0.0.1:6379> REDISQL.EXEC "SELECT * FROM text_search WHERE t LIKE 'h_llo';" 1) 1) "hello" 127.0.0.1:6379> REDISQL.EXEC "SELECT * FROM text_search WHERE t LIKE '%anana';" 1) 1) "banana" 127.0.0.1:6379> REDISQL.EXEC "INSERT INTO text_search VALUES('anana');" OK 127.0.0.1:6379> REDISQL.EXEC "SELECT * FROM text_search;" 1) 1) "hello" 2) 1) "banana" 3) 1) "apple" 4) 1) "anana" 127.0.0.1:6379> REDISQL.EXEC "SELECT * FROM text_search WHERE t LIKE 'a%';" 1) 1) "apple" 2) 1) "anana"
- alfanick 10y agoThis is just a bridge to in-memory sqlite accessible from redis connection – it does not emulate sql for redis data - both databases are completely independent, unfortunately.
- siscia 10y agoWhy you say unfortunately? What are your uses cases? It is possible to have in SQLite the keys from redis, however it does require a level of complexity that must be justified.
- aalekhN 10y agoAh, I was under impression that it emulates SQL nature for redis data (kind of like an extension to InnoDB Memcache architecture). Anyways nice work @siscia, thanks for sharing !!
- camtarn 10y agoThis paragraph is what I needed to see in the project readme. Thanks.
- deleted 10y ago[deleted]
- gtrubetskoy 10y agoThat's not hard to do, I did that in Thredis: redis 127.0.0.1:6379> set foo bar OK redis 127.0.0.1:6379> sql "select * from foo" 1) 1) "key" 2) "val" 2) 1) "1" 2) "bar"