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

Bug: Not supporting latest SurrealDB fully. #150

Open
2 tasks done
mahbubabbas opened this issue Sep 22, 2024 · 20 comments
Open
2 tasks done

Bug: Not supporting latest SurrealDB fully. #150

mahbubabbas opened this issue Sep 22, 2024 · 20 comments
Labels
bug Something isn't working

Comments

@mahbubabbas
Copy link

mahbubabbas commented Sep 22, 2024

Describe the bug

Not supporting latest SurrealDB fully.

Steps to reproduce

Not supporting latest SurrealDB fully.

Expected behaviour

Should support fully.

SurrealDB version

surreal 2.0.1, windows 11, golang sdk 0.2.1

Contact Details

[email protected]

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mahbubabbas mahbubabbas added the bug Something isn't working label Sep 22, 2024
@nickchomey
Copy link

nickchomey commented Sep 22, 2024

You are going to have to provide details about which ways this is not supporting surreal db fully...

@Sergionx
Copy link

I have the same issue, when I try to make any query I always resolves on a timeout error

@mahbubabbas
Copy link
Author

mahbubabbas commented Sep 23, 2024

if _, err = db.Query("SELECT * FROM $record", map[string]interface{}{
		"record": createdUser[0].ID,
	}); err != nil {
		panic(err)
	}

Ex: The above code always produces timeout error with SurrealDB 2.0.1 but it's working fine for SurrealDB 1.5.5. and lower.

@mahbubabbas
Copy link
Author

2024-09-25T12:32:01.827307Z WARN surreal::net::rpc: A connection was made without a specified protocol. 2024-09-25T12:32:01.827593Z WARN surreal::net::rpc: Automatic inference of the protocol format is deprecated in SurrealDB 2.0 and will be removed in SurrealDB 3.0.

I get the above warnings in my console

@nickchomey
Copy link

Again, You're using an ancient version of the sdk. Reporting issues on that is pointless.

Use the main branch or, better yet, the cbor branch. Or, just have some patience - they're overhauling the sdk right now in the cbor branch and will release a stable version soon

@mahbubabbas
Copy link
Author

mahbubabbas commented Sep 25, 2024

That's the only stable version available now brother as mentioned in the official website of SurrealDB. Could please let me know what's the "latest" version and where is that available?

@nickchomey
Copy link

https://stackoverflow.com/questions/53682247/how-to-point-go-module-dependency-in-go-mod-to-a-latest-commit-in-a-repo#53682399

Use a specific commit - choose latest from main or cbor branch.

And, again, have a bit of patience. They'll be done soon.

@mahbubabbas
Copy link
Author

@nickchomey Please go through the stackoverflow post you have shared. It never works.

@Sergionx
Copy link

I tried to download the latest version on main branch (v0.2.2-0.20240612173039-8f4a6983912f), but I still have the same issue and apparently the smartUnmarshal was removed

@nickchomey
Copy link

Ive started just using Query and then writing SurrealQL queries for pretty much everything right now, as I find various commands to be non-functional. When the sdk stabilizes i'll switch to the specific commands.

@nickchomey
Copy link

nickchomey commented Sep 27, 2024

I'm having the most success with commit 3d48437 of this sdk. The 3 commits after that seem to not work at all (to be fair, theyre called Work In Progress).

And i have SurrealDB v2.0.2

This works for me to get connected. Signin returns an error when you specify the Database and Namespace.

db, err := surrealdb.New("ws://localhost:8000")
	if err != nil {
		panic(err)
	}

	authData := &models.Auth{
		/* Database:  "conduit",
		Namespace: "conduit", */
		Username: "root",
		Password: "root",
	}
	if _, err = db.Signin(authData); err != nil {
		panic(err)
	}

	if _, err = db.Use("conduit", "conduit"); err != nil {
		panic(err)

@mahbubabbas
Copy link
Author

@nickchomey SDK works fine for me too up to the level you have mentioned in your code snippet above. But further query e.g. select, create, update are facing challenges.

@nickchomey
Copy link

I've had success with Insert. And Query.

We'll just have to make the most of what we have for now while they stabilize the sdk. Complaining does not help.

@Sergionx
Copy link

I always use Query, but without the Smart um marshal, I don't know the alternative to use

@mahbubabbas
Copy link
Author

mahbubabbas commented Sep 30, 2024

@nickchomey It's NOT mere complaining. In my case I am facing the problem in the following code:

        mTypeArray := []string{
		myconst.ModelTypeUser,
		myconst.ModelTypeRole,
		myconst.ModelTypeMenuApi,
		myconst.ModelTypeProfile,
	}
	qry := ""

	for _, m := range mTypeArray {
		factory := factory.GetFactory(m)
		myModel := factory.CreateModel()
		qry += myModel.DefineTable()
	}

	_, err := db.DB.Query(qry, nil)
	if err != nil {
		fmt.Println("Error creating db >>>", err)
	}

The above code is responsible for defining all my tables. It's giving me timeout error. Hence the SDK is not fully compatible with latest SurrealDB.

@mahbubabbas
Copy link
Author

@nickchomey If you are interested I can share my complete project.

@mahbubabbas
Copy link
Author

@nickchomey any updates?

@nickchomey
Copy link

Not sure why you're asking me?

Anyway, just look at the repo, branches and commits. The cbor branch was merged into main recently. Give it a try.

@mahbubabbas
Copy link
Author

When can we expect updates to support the latest SurrealDB i.e. 2.0.4?

@adamyeats
Copy link

Hey SurrealDB team! 👋 I see you're already hard at work on a new version of this library, but I just wanted to report that we've had a report from a user of the Grafana datasource for SurrealDB that specific time comparison queries are not working against SurrealDB v2.0 with the v0.2.1 (marked as current at time of writing) release of the library - it also produces a timeout as @mahbubabbas reports with their query. I just wanted to link the issue here in case that provides any useful information for you.

Typically, we do not pin datasource dependencies to Git SHAs, so for now we are going to declare the datasource as compatible with v1.0 only and await the new release. Best of luck with the new version! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants