2016-08-11 36 views
1

我想從python腳本中調用box.space.auth_user:auto_increment {「8」,7,7,7}。 這是我做的蟒蛇python-tarantool調用參數

import tarantool 
connection = tarantool.connect('127.0.0.1', 3303) 
connection.call('box.space.auth_user:auto_increment', ("8", 7, 7, 7)) 

然後我得到的錯誤:

[string "-- schema.lua (internal file)..."]:921: bad argument #1 to 'insert' (table expected, got string) 

這是我如何定義我的AUTH_USER模式

box.schema.space.create('auth_user',{if_not_exists=true}) 
box.space.auth_user:create_index('primary', {type='TREE', if_not_exists=true, unique=true, parts={1,'NUM'}}) 
box.space.auth_user:create_index('login', {type='HASH', if_not_exists=true, unique=true, parts={2,'STR'}}) 

我在做什麼錯誤?

回答

0

這不是一個錯誤,請使用[["8", 7, 7, 7]](("8", 7, 7, 7),)

In [4]: connection.call('box.space.auth_user:auto_increment', [["8", 7, 7, 7]]) 
Out[4]: 
- [1, '8', 7, 7, 7] 

tarantool-Python使用數組以顯示它的參數,所以這是模擬的box.space.auth_user:auto_increment("8", 7, 7, 7),不{}

+0

奏效,謝謝。沒有從文檔中獲得它 –