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

Merging hamster.db files #340

Closed
unfa opened this issue Nov 8, 2016 · 6 comments
Closed

Merging hamster.db files #340

unfa opened this issue Nov 8, 2016 · 6 comments
Labels

Comments

@unfa
Copy link

unfa commented Nov 8, 2016

I happen to have a few hamster.db files that I want to merge.
How can I do this?

I'd love to be able to import old hamster.db files into Hamster having them merged into the current one.

@elbenfreund
Copy link
Contributor

Each hamster.db is a independend sqlite3 database. I doubt there is a solid way to achieve what you ask for without significant import / conflict resolution logic (which does not exist as far as I know).
You could probably try turning each file into a csv and then use the dbus interface to add each row as a fact to your master hamster.db hoping that hamsters "squeeze" mechanism solves any conflicts.

Project hamster and its various sub-components is currently undergoing some major changes. We prepare the introduction of a rewritten codebase for most of the underlying functionality. A direct consequence of this is that it is unlikely that any open/new bugs within the current/old codebase will be fixed (unless someone steps up and offers to do so) as most resources currently available will be invested in making the rewrite prime time ready.

@unfa
Copy link
Author

unfa commented Jan 29, 2017

Ok, thank you.

have two .db files that should have no conflicts, I don't know the exact structure of the databases, but there are no duplicated events between the two files.

I'd like to just read all events listed and write them to a 3rd file.
I think I'll try my luck with http://sqlitebrowser.org/ to do this manually.

@neekfenwick
Copy link

@unfa did you make any progress on this? I'm moving from a laptop where I run hamster to a desktop where I used to run hamster, and want to merge the db on each. I imagine some kind of INSERT using the resultset of a SELECT would be possible in theory, did you try this and what was your general outcome? (disaster, success, partial mess, etc)

@jamesfryer
Copy link

I have used this script. Export records as a TSV then run this script on the file. Finally run the resulting file (using source command) on the target machine.

#! /bin/bash
# Take a time tracker TSV export and convert to series of hamster-cli start commands

if [[ "$1" == "" ]]; then echo "Please give me filename of Hamster TSV file"; exit 1; fi

filename="$1"
awk -F"\t" 'NR>1 {print "hamster-cli start \"" $1 "@" $5 "," $6 "\" \"" $2"-"$3"\""}' "$filename"

@GeraldJansen
Copy link
Contributor

I have developed a python script called htool, which can be used to merge two hamster.db databases. See here. For export it uses hamster's export functions, but for loading it skips duplicate or overlapping activities (with logging of the latter). It has not been widely tested, so be sure to back up your database(s) before using it.

@ederag
Copy link
Collaborator

ederag commented Sep 11, 2019

Thanks !

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

No branches or pull requests

6 participants