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

no such table: ga - erroring out #1452

Open
EntropyLives opened this issue Mar 22, 2024 · 5 comments
Open

no such table: ga - erroring out #1452

EntropyLives opened this issue Mar 22, 2024 · 5 comments

Comments

@EntropyLives
Copy link

Describe the bug
Running into an error with running OSXPhotos the first time. It crashes with the error "no such table: ga"

To Reproduce
Steps to reproduce the behavior:

  1. What' the full command line you used with osxphotos? osxphotos export /Volumes/Red\ Backup\ Drive/My\ Pictures/Ronen's\ iPhone\ Pictures/OSXPhotos --directory "{created.year}" --download-missing --update

  2. What was the error output?

  3. ronenhalevy@Mac-mini-2020 ~ % osxphotos export /Volumes/Red\ Backup\ Drive/My\ Pictures/Ronen's\ iPhone\ Pictures/OSXPhotos --directory "{created.year}" --download-missing --update
    Using last opened Photos library: /Volumes/Red Backup Drive/Photos Library.photoslibrary
    Using osxphotos export database: version 9.1 located at /Volumes/Red Backup Drive/My Pictures/Ronen's iPhone Pictures/OSXPhotos/.osxphotos_export.db
    Processing database /Volumes/Red Backup Drive/Photos Library.photoslibrary/database/photos.db
    Processing database /Volumes/Red Backup Drive/Photos Library.photoslibrary/database/Photos.sqlite
    Photos database version: 6000, 9.
    Processing persons in photos.
    Processing detected faces in photos.
    Processing albums.
    Processing keywords.
    Processing photo details.
    Processing import sessions.
    Processing additional photo details.
    Processing face details.
    Processing photo labels.
    Something went wrong and osxphotos encountered an error:
    no such table: ga
    Crash log written to '/Users/ronenhalevy/osxphotos_crash.log'
    Please file a bug report at https://github.com/RhetTbull/osxphotos/issues with the crash log attached.

Here is the crash log
osxphotos crash log
Created: 2024-03-22 12:48:42.159491
osxphotos version: 0.67.7
Platform: macOS-14.4-arm64-arm-64bit
Python version: 3.12.2 (main, Feb 6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)]
sys.argv: ['/Users/ronenhalevy/.local/bin/osxphotos', 'export', "/Volumes/Red Backup Drive/My Pictures/Ronen's iPhone Pictures/OSXPhotos", '--directory', '{created.year}', '--download-missing', '--update']
CRASH_DATA:
locals: {'dest': "/Volumes/Red Backup Drive/My Pictures/Ronen's iPhone Pictures/OSXPhotos", 'db': None, 'add_exported_to_album': None, 'add_missing_to_album': None, 'add_skipped_to_album': None, 'added_after': None, 'added_before': None, 'added_in_last': None, 'album': (), 'album_keyword': False, 'alt_db': None, 'alt_copy': False, 'append': False, 'fix_orientation': False, 'beta': False, 'burst': False, 'checkpoint': None, 'cleanup': False, 'cloudasset': False, 'config_only': False, 'convert_to_jpeg': False, 'crash_after': None, 'current_name': False, 'deleted': False, 'deleted_only': False, 'description': (), 'description_template': None, 'directory': '{created.year}', 'download_missing': True, 'dry_run': False, 'duplicate': False, 'edited': False, 'edited_suffix': None, 'exif': (), 'exiftool': False, 'exiftool_merge_keywords': False, 'exiftool_merge_persons': False, 'exiftool_option': (), 'exiftool_path': None, 'export_as_hardlink': False, 'export_by_date': False, 'exportdb': None, 'external_edit': False, 'favorite': False, 'favorite_rating': False, 'filename_template': None, 'finder_tag_keywords': False, 'finder_tag_template': (), 'folder': (), 'force_update': False, 'from_date': None, 'from_time': None, 'has_comment': False, 'has_likes': False, 'has_raw': False, 'hdr': False, 'hidden': False, 'ignore_case': False, 'ignore_date_modified': False, 'ignore_exportdb': False, 'ignore_signature': False, 'in_album': False, 'incloud': False, 'is_reference': False, 'jpeg_ext': None, 'jpeg_quality': None, 'keep': (), 'keyword': (), 'keyword_template': (), 'label': (), 'limit': None, 'live': False, 'load_config': None, 'location': False, 'max_size': None, 'min_size': None, 'missing': False, 'name': (), 'no_comment': False, 'no_description': False, 'no_exportdb': False, 'no_keyword': False, 'no_likes': False, 'no_location': False, 'no_place': False, 'no_progress': False, 'no_title': False, 'not_burst': False, 'not_cloudasset': False, 'not_edited': False, 'not_favorite': False, 'not_hdr': False, 'not_hidden': False, 'not_in_album': False, 'not_incloud': False, 'not_live': False, 'not_missing': False, 'not_panorama': False, 'not_portrait': False, 'not_reference': False, 'not_screenshot': False, 'not_selfie': False, 'not_shared': False, 'not_slow_mo': False, 'not_time_lapse': False, 'only_movies': False, 'only_new': False, 'only_photos': False, 'original_suffix': None, 'overwrite': False, 'panorama': False, 'person': (), 'person_keyword': False, 'place': (), 'portrait': False, 'post_command': (), 'post_command_error': None, 'post_function': (), 'preview': False, 'preview_if_missing': False, 'preview_suffix': None, 'print_template': (), 'query_eval': (), 'query_function': (), 'ramdb': False, 'regex': (), 'replace_keywords': False, 'report': None, 'retry': None, 'save_config': None, 'screenshot': False, 'selfie': False, 'shared': False, 'export_aae': False, 'sidecar': (), 'sidecar_drop_ext': False, 'sidecar_template': (), 'skip_bursts': False, 'skip_edited': False, 'skip_live': False, 'skip_original_if_edited': False, 'skip_raw': False, 'skip_uuid': (), 'skip_uuid_from_file': None, 'slow_mo': False, 'strip': False, 'theme': None, 'time_lapse': False, 'timestamp': False, 'title': (), 'tmpdir': None, 'to_date': None, 'to_time': None, 'touch_file': False, 'update': True, 'update_errors': False, 'use_photokit': False, 'use_photos_export': False, 'uti': None, 'uuid': (), 'uuid_from_file': None, 'verbose_flag': 0, 'xattr_template': (), 'year': (), 'syndicated': False, 'not_syndicated': False, 'saved_to_library': False, 'not_saved_to_library': False, 'shared_moment': False, 'not_shared_moment': False, 'shared_library': False, 'not_shared_library': False, 'selected': False, 'ctx': <click.core.Context object at 0x1092d5c70>, 'cli_obj': <osxphotos.cli.cli.CLI_Obj object at 0x10c3e3b90>}
osxphotos version: 0.67.7
Error: no such table: ga
Traceback (most recent call last):
File "/Users/ronenhalevy/Library/Application Support/pipx/venvs/osxphotos/lib/python3.12/site-packages/osxphotos/crash_reporter.py", line 79, in wrapped
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ronenhalevy/Library/Application Support/pipx/venvs/osxphotos/lib/python3.12/site-packages/osxphotos/cli/export.py", line 1115, in export
return_code = export_cli(**locals())
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ronenhalevy/Library/Application Support/pipx/venvs/osxphotos/lib/python3.12/site-packages/osxphotos/cli/export.py", line 1862, in export_cli
photosdb = osxphotos.PhotosDB(
^^^^^^^^^^^^^^^^^^^
File "/Users/ronenhalevy/Library/Application Support/pipx/venvs/osxphotos/lib/python3.12/site-packages/osxphotos/photosdb/photosdb.py", line 419, in init
self._process_database5()
File "/Users/ronenhalevy/Library/Application Support/pipx/venvs/osxphotos/lib/python3.12/site-packages/osxphotos/photosdb/photosdb.py", line 2575, in _process_database5
self._process_searchinfo()
File "/Users/ronenhalevy/Library/Application Support/pipx/venvs/osxphotos/lib/python3.12/site-packages/osxphotos/photosdb/_photosdb_process_searchinfo.py", line 79, in _process_searchinfo
result = c.execute(
^^^^^^^^^^
sqlite3.OperationalError: no such table: ga

Expected behavior
Was expecting it to export the photos to the location

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS Sonoma 14.4
  • osxphotos version (osxphotos --version)
  • osxphotos, version 0.67.7
  • Python 3.12.2 (main, Feb 6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Additional context
Add any other context about the problem here.

@RhetTbull
Copy link
Owner

Try this in terminal and post the output here:

ls "/Volumes/Red Backup Drive/Photos Library.photoslibrary/database/search"

Then try this:

sqlite3 "/Volumes/Red Backup Drive/Photos Library.photoslibrary/database/search/psi.sqlite" ".schema" > psi.txt

and post the psi.txt file here.

This is an issue with the search database (where Photos stores AI tags about the photo).

@EntropyLives
Copy link
Author

EntropyLives commented Mar 22, 2024

psi.txt
Thanks! I am getting a blank psi.txt file that is 0 bytes

for the queries
Last login: Fri Mar 22 17:00:52 on ttys005
r@Mac-mini-2020 ~ % sqlite3 "/Volumes/Red Backup Drive/Photos Library.photoslibrary/database/search/psi.sqlite" ".schema" > psi.txt
r@Mac-mini-2020 ~ % sqlite3 "/Volumes/Red\ Backup\ Drive/Photos\ Library.photoslibrary/database/search/psi.sqlite" ".schema" > psi.txt
Error: unable to open database "/Volumes/Red\ Backup\ Drive/Photos\ Library.photoslibrary/database/search/psi.sqlite": unable to open database file
r@Mac-mini-2020 ~ % sqlite3 "/Volumes/Red Backup Drive/Photos Library.photoslibrary/database/search/psi.sqlite" ".schema" > psi.txt
r@Mac-mini-2020 ~ % sqlite3 "/Volumes/Red\ Backup\ Drive/Photos\ Library.photoslibrary/database/search/psi.sqlite" ".schema" > psi.txt
Error: unable to open database "/Volumes/Red\ Backup\ Drive/Photos\ Library.photoslibrary/database/search/psi.sqlite": unable to open database file
r@Mac-mini-2020 ~ % ls "/Volumes/Red Backup Drive/Photos Library.photoslibrary/database/search"
psi.sqlite psi.sqlite-shm psi.sqlite-wal spotlightProgress.plist synonyms.plist synonymsProcess.plist
r@Mac-mini-2020 ~ %

@RhetTbull
Copy link
Owner

Since the psi.sqlite file is there (that's the database that holds the labels/categories) but sqlite3 cannot read it, I'm guessing the issue is this file is corrupted. You can try to repair the Photos library which might fix the issue. I'll push an update to osxphotos in just a bit that will ignore the error (this isn't the first time I've seen this) but I believe the issue is likely a corrupted Photos library.

@RhetTbull
Copy link
Owner

Update to osxphotos 0.67.8 which should fix this (and fix, I mean ignore the error). You won't have access to the AI assigned labels/categories in osxphotos but there's nothing I can do about this. You should be able to export though.

@EntropyLives
Copy link
Author

Thank you that seems to have worked!

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