basho / riak-python-client

The Riak client for Python.
Apache License 2.0
320 stars 182 forks source link

'Failed to put 1 record(s)' error when inserting data [JIRA: CLIENTS-1087] #522

Closed EnyMan closed 7 years ago

EnyMan commented 7 years ago

Hi i am running Riak TS 1.5.1 and i want to insert some data with python, but i am getting "'Failed to put 1 record(s)'" error.

The table i created is 
CREATE TABLE checks(
url varchar not null, 
region varchar not null, 
location varchar not null, 
datetime timestamp not null, 
status boolean not null, 
error varchar, 
status_code sint64, 
redirects sint64, 
size_header sint64, 
size_total sint64, 
time_namelookup sint64, 
time_total sint64, 
speed sint64, 
PRIMARY KEY ((url, region, location, quantum(datetime, 15, 'm')),
              url, region, location, datetime ))

and i am inserting with table.new()

rows = [['web', 'dummy', 'dummy', 1000 + i, True, 'null', 200, 5, 50, 100, 5, 50, 50]]

as test where i is from 0 to 200

what am i doing wrong or is this Riak TS issue

alexmoore commented 7 years ago

Hi EnyMan,

I was able to insert the sample data you provided into your sample table definition.

import riak myClient = riak.RiakClient(pb_port=8087) myClient.ping() True

table = myClient.table('checks') rows = [['web', 'dummy', 'dummy', 1001, True, 'null', 200, 5, 50, 100, 5, 50, 50]] ts_obj = table.new(rows) print "Store result:", ts_obj.store() Store result: True

  1. What version of python are you using?
  2. How did you install the riak python client?
  3. What is the type of your 'i' variable?

Thanks, Alex

On Fri, Feb 10, 2017 at 8:05 AM, EnyMan notifications@github.com wrote:

Hi i am running Riak TS 1.5.1 and i want to insert some data with python, but i am getting "'Failed to put 1 record(s)'" error.

The table i created is CREATE TABLE checks( url varchar not null, region varchar not null, location varchar not null, datetime timestamp not null, status boolean not null, error varchar, status_code sint64, redirects sint64, size_header sint64, size_total sint64, time_namelookup sint64, time_total sint64, speed sint64, PRIMARY KEY ((url, region, location, quantum(datetime, 15, 'm')), url, region, location, datetime ))

and i am inserting with table.new()

rows = [['web', 'dummy', 'dummy', 1000 + i, True, 'null', 200, 5, 50, 100, 5, 50, 50]]

as test where i is from 0 to 200

what am i doing wrong or is this Riak TS issue

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/basho/riak-python-client/issues/522, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAFnu5NrtzAtZYE33hJtyZw3u1DOgVaks5rbGCYgaJpZM4L9W-S .

EnyMan commented 7 years ago

Hi alex i am using python3.4 and riak TS 1.5.1 and i installed riak python client with pip and i is int from range

lukebakken commented 7 years ago

Could you please issue an INSERT command using riak-shell for one row of data?

EnyMan commented 7 years ago

i tried inserting INSERT INTO checks VALUES ('web', 'dummy', 'dummy', 1000, True, 'null', 200, 5, 50, 100, 5, 50, 50); and that works

alexmoore commented 7 years ago

@EnyMan Could you share the code you're using to setup the client, table object, and writing the row?

EnyMan commented 7 years ago

sure

client = RiakClient(host='127.0.0.1', pb_port=8087)
table = client.table('checks')

for i in range(200):
    rows = [['web', 'dummy', 'dummy', 1000+i, True, 'null', 200, 5, 50, 100, 5, 50, 50]]
    ts_obj=table.new(rows)
    if(not ts_obj.store()):
        print("Error while inserting")

EDIT: could be the problem that i am running it inside a docker?

alexmoore commented 7 years ago

Yeah, that code works here too. I can query all 200 rows too with:

query = "select * from checks where url = 'web' and region = 'dummy' and location = 'dummy' and datetime < 2000 and datetime > 0"
ts_obj = client.ts_query('checks', query)
len(ts_obj.rows)

200

It's possible it could be an issue with your docker container. Could you share Riak's console.log* files?

lukebakken commented 7 years ago

Actually ... how about all of your log files in an archive? Thanks.

EnyMan commented 7 years ago

sure here there are after the script https://transfer.sh/zh7AJ/logs.tar EDIT: added zip file riak-mous.zip

lukebakken commented 7 years ago

There aren't any errors in the log file. Since we can't reproduce this issue, I have to assume it's due to your environment.

Please give Basho's docker image a try, or try to reproduce your issue not using docker. If you can reproduce this issue in either of those cases, please re-open this GH issue and let us know.

Basho-JIRA commented 7 years ago

Fixed, or closed via GitHub issues.

[posted via JIRA by Alexander Moore]