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

Feature: modify RETURN value #150

Open
2 tasks done
J05HM0N5TER opened this issue Nov 22, 2024 · 3 comments
Open
2 tasks done

Feature: modify RETURN value #150

J05HM0N5TER opened this issue Nov 22, 2024 · 3 comments

Comments

@J05HM0N5TER
Copy link

Is your feature request related to a problem?

When I use Upsert, Insert, or Update, I want to be able to change the return value to NONE for performance improvements. I am migrating a lot of data and producing the ID's before I create them in SurrealDB and store them in Valkey, which I found is faster for storing simple mappings between strings and IDs. When I write the SurrealQL directly, then I can specify this, and it seems to give better performance.

Describe the solution

Provide an Enum for the return type as a parameter which has the options NONE, BEFORE, AFTER (the default). I am not sure if the others are practical when deserilising them into a C# object.

Alternative methods

Maybe have a separate function where it's called InsertWithoutRespose? I think this options is a lot worse than the primary solution idea.

SurrealDB version

2.1.0 for linux on x86_64

Package version(s)

 [net9.0]: 
 Top-level Package                                 Requested   Resolved
 > CsvHelper                                       33.0.1      33.0.1  
 > Microsoft.Data.Sqlite                           9.0.0       9.0.0   
 > Microsoft.EntityFrameworkCore                   9.0.0       9.0.0   
 > Microsoft.EntityFrameworkCore.Abstractions      9.0.0       9.0.0   
 > Microsoft.EntityFrameworkCore.Sqlite            9.0.0       9.0.0   
 > Microsoft.Extensions.Hosting                    9.0.0       9.0.0   
 > NRedisStack                                     0.13.0      0.13.0  
 > SurrealDb.Net                                   0.6.0       0.6.0   
 > System.Threading.Tasks.Dataflow                 9.0.0       9.0.0   

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
@Odonno
Copy link
Contributor

Odonno commented Nov 22, 2024

Hello @J05HM0N5TER

Well, this is an interesting idea. However, the core database does not support this behavior at the moment. If you want to see something like this, I suggest you to create an issue in this repository. Once this is implemented in the core database, we could then implement this behavior in every SurrealDB SDK including the .NET one.

@J05HM0N5TER
Copy link
Author

J05HM0N5TER commented Nov 23, 2024

@Odonno I don't understand, what do you mean by it doesn't support it? Is this something to do with the cbor communication or something? I linked documentation on how to do it using surrealQL, and I have used if myself.

@Odonno
Copy link
Contributor

Odonno commented Nov 23, 2024

The Upsert or any other method is using the SurealDB rpc endpoint. You can find the docs here https://surrealdb.com/docs/surrealdb/integration/rpc

These methods only return the AFTER value. If you want to be able to change the return type in any SDK, either NONE, BEFORE or DIFF, we should first start by changing the behavior on the server.

On the other hand, if you want this behavior right now, I suppose you can use the Query method and write the SurrealQL queries manually.

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