-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* prototyping * nothing * adjust ini usage * ini * Fixing docs. * satisfy abc for deprecated db * indent fix * few more formatting fixes * more format fixes * refactor db init in Tru * move large design decision sections from docstrings to a single md file. * add design.md and notes * doc fixes * cleaning up db implementation docs and some code * work * forgot some * add database_prefix to Tru * moving and renaming things * ignores * fixes from the move/renames * remove accidental file * more fixes, and fix reset_database * print arg parse exception * streamlit state fixes * forgot to remove old import * update database migration notes and copy_database * move old database to legacy databases folder * rename class * typos and doc fixes * nits * nits * testing copy_database * format * working on prefix tests * debugging the foreign keys * debugging more * clean up * typo * moved on_done_callback content into result() and added some database tests * undo non-needed * change alembic logging output * moved db revision migration check to Tru init --------- Co-authored-by: Aaron <[email protected]>
- Loading branch information
Showing
43 changed files
with
2,049 additions
and
897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
::: trulens_eval.database.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# 🕸✨ Database Migration | ||
|
||
When upgrading _TruLens-Eval_, it may sometimes be required to migrade the | ||
database to incorporate changes in existing database created from the previously | ||
installed version. The changes to database schemas is handled by | ||
[Alembic](https://github.com/sqlalchemy/alembic/) while some data changes are | ||
handled by converters in [the data | ||
module][trulens_eval.database.migrations.data]. | ||
|
||
## Upgrading to the latest schema revision | ||
|
||
```python | ||
from trulens_eval import Tru | ||
|
||
tru = Tru( | ||
database_url="<sqlalchemy_url>", | ||
database_prefix="trulens_" # default, may be ommitted | ||
) | ||
tru.migrate_database() | ||
``` | ||
|
||
## Changing database prefix | ||
|
||
Since `0.28.0`, all tables used by _TruLens-Eval_ are prefixed with "trulens_" | ||
including the special `alembic_version` table used for tracking schema changes. | ||
Upgrading to `0.28.0` for the first time will require a migration as specified | ||
above. This migration assumes that the prefix in the existing database was | ||
blank. | ||
|
||
If you need to change this prefix after migration, you may need to specify the | ||
old prefix when invoking | ||
[migrate_database][trulens_eval.tru.Tru.migrate_database]: | ||
|
||
```python | ||
tru = Tru( | ||
database_url="<sqlalchemy_url>", | ||
database_prefix="new_prefix" | ||
) | ||
tru.migrate_database(prior_prefix="old_prefix") | ||
``` | ||
|
||
## Copying a database | ||
|
||
Have a look at the help text for `copy_database` and take into account all the | ||
items under the section `Important considerations`: | ||
|
||
```python | ||
from trulens_eval.database.utils import copy_database | ||
|
||
help(copy_database) | ||
``` | ||
|
||
Copy all data from the source database into an EMPTY target database: | ||
|
||
```python | ||
from trulens_eval.database.utils import copy_database | ||
|
||
copy_database( | ||
src_url="<source_db_url>", | ||
tgt_url="<target_db_url>", | ||
src_prefix="<source_db_prefix>", | ||
tgt_prefix="<target_db_prefix>" | ||
) | ||
``` | ||
|
||
::: trulens_eval.tru.Tru.migrate_database | ||
|
||
::: trulens_eval.database.utils.copy_database | ||
|
||
::: trulens_eval.database.migrations.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# 🧪 SQLAlchemy Databases | ||
|
||
::: trulens_eval.database.sqlalchemy | ||
|
||
::: trulens_eval.database.orm |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
default.sqlite | ||
paul_graham_essay.txt |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.