Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

SQLite migration reports the source event count after skipping rows

Ouverte Adaptée aux débutants
#7,298 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
88/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python, sqlalchemy, sqlite
Domaine
databases

Piste de recherche

Commencez par google/adk/sessions/migration/migrate_from_sqlalchemy_sqlite.py et comparez son comportement de comptage avec migrate_from_sqlalchemy_pickle.py. Exécutez tests/unittests/sessions/migration/test_migration.py::test_sqlite_migration_reports_only_migrated_events ; c’est terminé lorsqu’un échec de conversion laisse dans la destination uniquement les lignes traitées avec succès et que le journal de migration identifie correctement les événements migrés et ignorés.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

🔴 Required Information

Describe the Bug:
migrate_from_sqlalchemy_sqlite.migrate skips any event row whose to_event() raises, logs a per-row warning, and then reports Migrated {len(events)} events. — the number of rows in the source table, not the number inserted. The transaction is committed and the run ends with Migration completed successfully., so a migration that permanently dropped events reports the full count. The pickle migration in the same package already counts successful inserts (num_rows in migrate_from_sqlalchemy_pickle.py).

Steps to Reproduce:

  1. Create a v0 SQLite database with one session and two event rows.
  2. Make one row unconvertible, e.g. by making StorageEvent.to_event() raise for it.
  3. Run python -m google.adk.sessions.migration.migrate_from_sqlalchemy_sqlite --source_db_url sqlite:///source.db --dest_db_path dest.db.
  4. Read the log.

Expected Behavior:
The summary counts the rows that were actually migrated, and the rows that were skipped are named, so the operator can tell the destination is incomplete before following the script's own "rename your database" instruction.

Observed Behavior:

WARNING ... Failed to migrate event event2: unreadable event payload
INFO    ... Migrated 2 events.
INFO    ... Migration completed successfully.

dest.db contains one event row (event1).

Environment Details:

  • ADK Library Version: main @ 044a1ec3
  • Desktop OS: macOS
  • Python Version: 3.14.5

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: N/A (offline migration script)

🟡 Optional Information

Regression:
The count has been the source row count since the script was added.

Logs:

INFO     ... Migrating events...
WARNING  ... Failed to migrate event event2: unreadable event payload
INFO     ... Migrated 2 events.
INFO     ... Migration completed successfully.

Additional Context:
I hit this while auditing the two migration scripts against each other. A regression test that builds a two-event source DB, fails one conversion, and asserts the log reports Migrated 1 events. fails on main today. I have a fix ready that counts successful inserts and adds one warning naming the skipped ids; happy to open the PR, or to keep it even smaller if you would rather only fix the count.

Minimal Reproduction Code:
The test in the PR (tests/unittests/sessions/migration/test_migration.py::test_sqlite_migration_reports_only_migrated_events) is self-contained: it builds the v0 database, patches to_event for one row, runs migrate(), and asserts both the destination contents and the log.

How often has this issue occurred?:

  • Always (100%) whenever a row fails to convert
Langage dominant
Python
Étoiles
21.6k
Forks
4k
Merge moyen
12 h 6 min
PR mergées (30 j)
4

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de google/adk-python

Toutes les issues de google/adk-python

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.