Calling mass insert using redis protocol file from a python program

31 views
Skip to first unread message

Bahata Ansumali

unread,
Dec 6, 2018, 7:51:49 AM12/6/18
to Redis DB
Hi
The way from commandline, "cat data.txt | redis-cli --pipe" can be run, if I want to run that using a python program, where I have the data with redis commands translated in protocol already, how shall I call it.
I already have a file created in a specific path that contains data in following format. Now I need to execute this file from inside a python program rather than from commandline.
I am new to both python and redis. Can someone give me the sample code to call a file using the redis pipeline? I already have access to pipeline using the code
pipe = self.connection.pipeline()


--------------------------------
File content
----------------------------------
*3
$3
SET
$39
1000000003-2000000004:1.54409744633e+12
$11
573.67:1185
*3
$3
SET
$39
1000000003-2000000007:1.54409744633e+12
$10
753.67:488

Reply all
Reply to author
Forward
0 new messages