Table Of Contents

Previous topic

oyProjectManager.core.models.VersionType

Next topic

oyProjectManager.db.declarative

This Page

oyProjectManager.db

Database Module

This is where all the magic happens.

New in version 0.2.0: SQLite3 Database:

To hold the information about all the data created Projects, Sequences, Shots, Assets and VersionTypes , there is a ”.metadata.db” file in the repository root. This SQLite3 database has all the information about everything.

With this new extension it is much faster to query any data needed.

Querying data is very simple and fun. To get any kind of data from the database, just call the db.setup() and then use db.query to get the data.

For a simple example, lets get all the shots for a Sequence called “TEST_SEQ” in the “TEST_PROJECT”:

from oyProjectManager import db
from oyProjectManager.core.models import Project, Sequence, Shot

# setup the database session
db.setup()

all_shots = Shot.query().join(Sequence).      filter(Sequence.project.name="TEST_PROJECT").      filter(Shot.sequence.name=="TEST_SEQ").all()

that’s it.

Functions

setup([database_url_in]) Utility function that helps to connect the system to the given database.

Classes

Base(**kwargs)