Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to create space with v2 NewCallRequest #10021

Open
kcaashish opened this issue May 14, 2024 · 1 comment
Open

unable to create space with v2 NewCallRequest #10021

kcaashish opened this issue May 14, 2024 · 1 comment
Labels
needs feedback Something is unclear with the issue question Further information is requested

Comments

@kcaashish
Copy link

How can we create a space with a call request?

data, err := conn.Do(tarantool.NewCallRequest(`box.schema.space.create`).Args([]interface{}{
`test1`,
map[string]interface{}{
	`engine`:        `vinyl`,
	"if_not_exists": true,
},
})).Get()

I was trying to do it in this way, but I get an unsupported Lua type 'function' error.

I tried it with GetResponse() and that didn't work either.

@oleg-jukovec
Copy link
Contributor

oleg-jukovec commented May 14, 2024

The problem on the server-side. The return value of the call (a new space) contains functions/user data, the Tarantool's msgpack encoder unable to encode it.

You need to use the EvalRequest or you could create a lua-procedure on the server side, something like this:

_G.create_space = function(...)
    box.schema.space.create(...)
end

And call it with the call request.

See:
tarantool/go-tarantool#94

@oleg-jukovec oleg-jukovec added question Further information is requested needs feedback Something is unclear with the issue labels May 14, 2024
@sergos sergos transferred this issue from tarantool/go-tarantool May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs feedback Something is unclear with the issue question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants