Repository navigation
Conversation
|
This is interesting. Not sure what I would use it for, but it sounds cool. |
|
very curious to see how this goes when it matures 😋 |
|
Updates above in the PR description. |
|
So I am kicking the tires on this PR and will add some feedback as I spend more time with it... Initially I was wondering why the code was being added to nu-protocol Prior to this PR nu-protocol pulled in 131 crates |
|
I have been spending more time working with nu-protocol and now I am hesitating (once again) to add rusqlite as a dependency to nu-protocol... It just doesn't feel like the correct spot --- meaning maybe there is another way to solve this problem... I don't know 😄 but just thought I would add my thoughts as I think about this more... |
|
Like I said in the description, if you want to use An alternate route would be to instantiate the database in The idea is to have a in-memory database accessible at all times, either approach achieves that I think. |
|
Thanks for the added alternative description of it being in main instead... I like it better the way you have it now with the extra magic 😄 Meaning for now rusqlite has to be in nu-protocol... And now I have a better understanding of the EnvVars being in the EngineState pub struct EngineState {
...
pub env_vars: EnvVars,The depth and breadth of our product continues to expand which is very cool... It just means there is so much more to keep in our mental stack of all of the moving pieces and parts. Its good for my brain, just sometimes overwhelming... |
|
I still think this is a cool feature but there doesn't seem to be a lot of interest in it 😭, unfortunately. So, I'll probably end up closing it at some point. I still think people are missing the usefulness of having a db available at any time in memory. |
|
I'd personally want to see it and try it out, it sounds really cool to me. |
|
@kubouch I merged the latest main into this PR so you can play with it. It'll still have errors because I left some unwraps, but I tested it out and it's fine for playing around. |
|
superseded by #11170 |
Description
Warning
This PR is not finished and is meant as a proof of concept. I will clean this up shortly and continue polishing it if we decide to move forward. There are some changes that may not be wanted, namely depending on rusqlite. I also moved some things around to make access to them easier without having circular references.
Note
To test it out, simply checkout this PR then see the notes below for a simple test. Ideally, we'd want to have commands that do the sql so users don't have to.
This PR adds a
$dbsystem variable. In this variable is a in-memory sqlite db that can be used for anything or nothing. It should be accessible via scripts and the repl.The idea was just a thought like, "Wouldn't it be cool if there was just a database hanging around in memory and I could store anything in it that I need to while working on data.".
The in-memory db is active while nushell is running. When nushell exits the database and all of its contents are gone. Any command that's run from inside the nushell process can access this database. I'm guessing that means that plugins cannot access it since they are separate executables and separate processes, but I haven't tried yet.
I had to move the sqlitedatabase stuff over to nu-protocol because we wouldn't want to add a nu-command dependency to nu-protocol. Also, if you want to have a
$dbvariable, you have to do that in nu-protocol so that you can access it in nu-engine so you don't have circular dependencies.Note
Update 2023-10-12
I've cleaned up the PR a bit so it's not as "wild" and full of debug statements. You should start by typing
$dband be greeted with these instructions. I still have someunwrap()'s but it should compile for you to play with.User-Facing Changes
Tests + Formatting
After Submitting