Skip to content

Instantly share code, notes, and snippets.

@lbell
Forked from oscarfonts/hamster2toggl.sql
Last active February 8, 2021 20:37
Show Gist options
  • Select an option

  • Save lbell/b4e2346fe3f5b7a0916f1079d5a1db4a to your computer and use it in GitHub Desktop.

Select an option

Save lbell/b4e2346fe3f5b7a0916f1079d5a1db4a to your computer and use it in GitHub Desktop.
SQL query to export Hamster database to toggl time tracker
select
"[email protected]" as 'Email',
date(facts.start_time) as 'Start date',
time(facts.start_time) as 'Start time',
strftime('%H:%M:%S', strftime('%s',facts.end_time) - strftime('%s',facts.start_time), 'unixepoch') as 'Duration',
categories.name as 'Project',
activities.name as 'Description',
tags.name as 'Tags'
from
facts, categories, activities, fact_tags, tags
where
facts.activity_id = activities.id
and activities.category_id = categories.id
and facts.id = fact_tags.fact_id
and tags.id = fact_tags.tag_id;
@lbell
Copy link
Author

lbell commented Feb 8, 2021

Added tag (just pulls the first tag it comes across which is fine for me since I only usually use one tag)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment