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

func ExecuteWithParameter can't execute, ErrorCode: -1005 #263

Closed
TuoLe opened this issue Mar 22, 2023 · 1 comment
Closed

func ExecuteWithParameter can't execute, ErrorCode: -1005 #263

TuoLe opened this issue Mar 22, 2023 · 1 comment

Comments

@TuoLe
Copy link

TuoLe commented Mar 22, 2023

nebula version: 3.1.0
Installation method: docker-compose
nebula-go version: v3.4.0

The following code uses the nebula-go library, and its function is to store an object of type map[string]interface{} into the nebulagraph database through the ExecuteWithParameter function.

Now a bug is encountered during the execution of this code: ErrorCode: -1005, ErrorMsg: Storage Error: The data type does not meet the requirements. Use the correct type of data.

func AddVertex(ptrPool *nebula.ConnectionPool) error {
	// Create session
	session, err := ptrPool.GetSession(username, password)
	if err != nil {
		log.Fatal(fmt.Sprintf("Fail to create a new session from connection pool, "+
			"username: %s, password: %s, %s", username, password, err.Error()))
		return err
	}
	// Release session and return connection back to connection pool
	defer session.Release()

	personMap := make(map[string]interface{})
	personMap["Height"] = 1.78
	personMap["Name"] = "asd"

	insertNGQL := ` 
		CREATE SPACE IF NOT EXISTS Myspace(vid_type=FIXED_STRING(20));
		USE Myspace;

		CREATE TAG IF NOT EXISTS Person (Height double null, Name string null);

		INSERT VERTEX Person (Height, Name)
		VALUES
		"aaaaaaaaaaaaaaaaaaaa":($Height, $Name);
	`

	_, _ = session.Execute("USE Myspace;")

	// Send
	resultSet, err := session.ExecuteWithParameter(insertNGQL, personMap)
	if err != nil {
		fmt.Print(err.Error())
		return err
	}
	checkResultSet("test", resultSet)

	return nil
}

Is my usage wrong and how to resolve it?

@QingZ11
Copy link

QingZ11 commented Mar 31, 2023

This question is similar to this question: https://discuss.nebula-graph.com.cn/t/topic/12512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants