How To... Guides

Links to documentations that discuss how to do things.

How To Add an Object to the Database

  • Open pcty/cont_classes/DB_ProblemData.py

  • At the top are various global data structures. Edit the following:
    • Add the object's handle to ClassKeys under its class.

    • If the object has any sub-objects, then add the object and its sub-objects to SubObjectKeys.

    • Add the object's handle to PrettyObjects and keyed to its user-interface version.

    • If the object does not have an associated form, add its handle to ObjsWithoutForm.

    • If the object needs other objects to be viewed, add them to FormObjects.

  • Open pcty/client/forms/SearchDatabaseForm.py

  • Go to the bottom. Inside function openForm() of class FormViewer, add an elif clause that will open the form the same way it is called in its menu command class (just like the other objects are opened).

  • Make sure the object is accessible via getMetadataTypes() and getMetadata() in the ConatinerObj class of pcty/client/StoredData.py.

How To Add an Attribute Type to the Database

  • Open pcty/cont_classes/DB_ProblemData.py

  • At the top are various global data structures. Edit the following:
    • Add the type's system version to AttributeTypes.

    • Add the type's system version version to PrettyAttTypes keyed with its user-interface version.

How To Create a User on the Continuity/Owners Table

  • Go to the stored_procedures.sql which is in cont_dev/pcty/client/database/stored_procedures.sql and check the add_owner function arguments to pass.
  • Go To pgAdmin and open a SQl Editor and call "add_owner" function with the necessary arguments.
  • Example: Select add_owner('<first_name>', '<last_name>' ...);

How To Update Functions on the database

  • All functions in the database are stored in a file: pcty/client/database/stored_procedures.sql.
  • The easiest was to up date a particular function is to cut/paste that function from the stored_procedures.sql document into the pgAdmin SQL window and simply execute the SQL statements.
  • You must then do a refresh in the pgAdmin window to actually see the updated/new function.

  • Check in the stored_procedures.sql when things are working correctly.

How To Work with the Development Database

  • There are two databases that Continuity can acces, the production one and the development one. By default the production database is the one that is used; however, for testing purposes, one can choose to use the development database.
  • In the Continuity Preference file, change useProductionDatabase:=True to useProductionDatabase:=False

How To Build Python Interface to the DB

  • We use the PostGreSQL Database, version 8.4. We need to use a compiled library to access the database, and we have been using PyGreSQL for that library, which we have been building ourselves. The resultant library (_pg.so) gets placed inside MGLTools.