Repository: truera/trulens
Issue: [BUG] Mistyped variable names in DB.delete_app function in sqlalchemy.py
Root cause: Validation Gap

**Bug Description**
Using tru.delete_app(app_id) throws an error because of mistyped variable names.

**To Reproduce**
- Create Tru database with default settings.
- Create an app with an app_id.
- Try deleting it with delete_app functionality of Tru class.

**Expected behavior**
- The app and its' records deleted from the database of Trulens.

**Relevant Logs/Tracebacks**
Traceback (most recent call last):
  File "D:\Tetris\server\trulens_middleware\reset_database.py", line 6, in <module>
    tru.delete_app(app_id=os.getenv("TRULENS_APP_ID"))
  File "D:\Tetris\server\.venv\Lib\site-packages\trulens_eval\tru.py", line 565, in delete_app
    self.db.delete_app(app_id=app_id)
  File "D:\Tetris\server\.venv\Lib\site-packages\trulens_eval\database\sqlalchemy.py", line 373, in delete_app
    with self.Session.begin() as session:
         ^^^^^^^^^^^^
  File "D:\Tetris\server\.venv\Lib\site-packages\pydantic\main.py", line 828, in __getattr__
    raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'SQLAlchemyDB' object has no attribute 'Session'. Did you mean: 'session'?

**Environment:**
 - OS: [Windows]
 - Python Version - 3.11.7
 - TruLens version - 0.33.0


**Additional context**
Add any other context about the problem here.


<!-- Greeting -->
Hey there, @rishwanth-thiyagaraj! I'm here to help you with any bugs, questions, or contribution guidance you need. Let's work together to solve this issue.

<!-- Answer -->
To fix the mistyped variable names in the `DB.delete_app` function in `sqlalchemy.py` that cause an `AttributeError` when trying to delete an app, you need to ensure that the correct session object and ORM class are used. The correct session object is `self.session`, and the ORM class for the app definition is `self.orm.AppDefinition`.

Here is the corrected `delete_app` function:

```python
def delete_app(self, app_id: mod_types_schema.AppID) -> None:
    """
    Deletes an app from the database based on its app_id.

    Args:
        app_id (schema.AppID): The unique identifier of the app to be deleted.
    """
    with self.session.begin() as session:
        _app = session.query(self.orm.AppDefinition).filter_by(app_id=app_id).first()
        if _app:
            session.delete(_app)
            logger.info(f"{UNICODE_CHECK} deleted app {app_id}")
        else:
            logger.warning(f"App {app_id} not found for deletion.")
```

This ensures that the correct session (`self.session`) and ORM class (`self.orm.AppDefinition`) are used, preventing the `AttributeError` <sup>[[1]](https://github.com/truera/trulens/blob/main/trulens_eval/trulens_eval/database/sqlalchemy.py)</sup>.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*


<!-- Answer -->
To contribute changes to the `trulens` repository, you typically need to follow these steps:

1. **Fork the Repository**: Go to the `trulens` repository on GitHub and click the "Fork" button to create your own copy of the repository.

2. **Clone Your Fork**: Clone your forked repository to your local machine using:
   ```sh
   git clone https://github.com/your-username/trulens.git
   ```

3. **Create a Branch**: Create a new branch for your changes:
   ```sh
   git checkout -b your-branch-name
   ```

4. **Make Your Changes**: Implement the changes you want to make in your local repository.

5. **Commit Your Changes**: Commit your changes with a descriptive message:
   ```sh
   git add .
   git commit -m "Description of the changes"
   ```

6. **Push Your Changes**: Push your changes to your forked repository:
   ```sh
   git push origin your-branch-name
   ```

7. **Create a Pull Request**: Go to the original `trulens` repository and click the "New Pull Request" button. Select your branch and submit the pull request with a clear description of your changes.

For more detailed information on contributing, refer to the [contributing guide](https://www.trulens.org/trulens_eval/contributing/) <sup>[[1]](https://github.com/truera/trulens/blob/main/docs/trulens_eval/contributing/index.md)</sup><sup>[[2]](https://github.com/truera/trulens/blob/main/trulens_eval/README.md)</sup>.

If you need further assistance or permissions, it might be best to reach out to a maintainer. This is a tough nut to crack, could really use your help on this, @joshreini1.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*