trulens.core.database.legacy.migration¶
trulens.core.database.legacy.migration
¶
This is pre-sqlalchemy db migration. This file should not need changes. It is here for backwards compatibility of oldest TruLens versions.
Attributes¶
logger
module-attribute
¶
logger = getLogger(__name__)
How to make a db migrations:
-
Create a compatibility DB (checkout the last pypi rc branch https://github.com/truera/trulens/tree/releases/rc-trulens-X.x.x/): In trulens/tests/docs_notebooks/notebooks_to_test remove any local dbs
- rm rf default.sqlite run below notebooks (Making sure you also run with the same X.x.x version trulens)
- all_tools.ipynb # cp cp ../generated_files/all_tools.ipynb ./
- llama_index_quickstart.ipynb # cp frameworks/llama_index/llama_index_quickstart.ipynb ./
- langchain-retrieval-augmentation-with-trulens.ipynb # cp vector-dbs/pinecone/langchain-retrieval-augmentation-with-trulens.ipynb ./
- Add any other notebooks you think may have possible breaking changes replace the last compatible db with this new db file
- See the last COMPAT_VERSION: compatible version in leftmost below: migration_versions
- mv default.sqlite trulens/release_dbs/COMPAT_VERSION/default.sqlite
-
Do Migration coding
- Update init.py with the new version
- The upgrade methodology is determined by this data structure upgrade_paths = { # from_version: (to_version,migrate_function) "0.1.2": ("0.2.0", migrate_0_1_2), "0.2.0": ("0.3.0", migrate_0_2_0) }
-
add your version to the version list: migration_versions: list = [YOUR VERSION HERE,...,"0.3.0", "0.2.0", "0.1.2"]
-
To Test
-
replace your db file with an old version db first and see if the session.migrate_database() works.
-
Add a DB file for testing new breaking changes (Same as step 1: but with your new version)
- Do a sys.path.insert(0,TRULENS_PATH) to run with your version
Classes¶
UnknownClass
¶
Functions¶
commit_migrated_version
¶
commit_migrated_version(db, version: str) -> None
After a successful migration, update the DB meta version
PARAMETER | DESCRIPTION |
---|---|
db |
the db object
TYPE:
|
version |
The version string to set this DB to
TYPE:
|
migrate
¶
migrate(db) -> None
Migrate a db to the compatible version of this pypi version
PARAMETER | DESCRIPTION |
---|---|
db |
the db object
TYPE:
|