Programmatic import
Opened this issue Β· 4 comments
So I have been using my own history tool for quite some time now, and have 220K+ commands in a file (+ other backed up files from other machines), in a custom format, that I'd like to import in Atuin π
How would I go about feeding Atuin programmatically, since surely the import
subcommand will not support my history file format? You can assume I have all the necessary fields (and more π).
Hmmm I guess I could simply check the database schema and insert things in it directly ^^
It's not quite that simple I'm afraid. We actually have two databases, and it's important to ensure that data is copied across them properly.
- records.db: this stores your shell history data encrypted, on disk. It's used for syncing cross-machine, and is not at all editable manually
- history.db: this contains your actual shell history data, in a format we can search and browse
I'd first disable auto-sync if you've already set it up. auto_sync = false
in your config file.
There is a command that will take the data from history.db, and insert it into records.db. Once you've inserted to history.db, run:
atuin history init-store
This should be idempotent, and the process may happen automatically at sync time.
Once complete, I'd issue
atuin store rebuild history
This will wipe out history.db, and rebuild it from the records.db. Just to make sure everything is consistent!
Then, run
atuin sync
You should be good to go from here, and can re-enable auto_sync.
also - love all the graphs from your tool!
Awesome, thank you so much for the clear instructions! I'll try that and report back π
also - love all the graphs from your tool!
Thanks! I believe you have everything you need to offer similar graphs in Atuin too π I could actually consider contributing if that's something you're interested in