Skip to main content

Intro

Pikaview - an ORM Resource

Pikaview is a Object-Relational Mapping (ORM) library that features both scripting and Perspective resources with the aim of simplifying common database actions.

The scripting resources provide a database agnostic implementation of common database table actions, including create, read, update and delete. The scripting resources also support the usage of object-oriented design by extending the Model Class.

The Perspective components are designed to work directly with the scripting resources in order to provide easy solutions for common tasks, such as a Table to display records, a form with the ability to insert/update rows in a Table, or a search panel able to build filters on the fly.
Click here for the full list of Perspective components included in this library.

Usage Examples

Getting a Service
contactService = exchange.pikaview.service_factory.GetModelServiceClass(tableName = 'contacts', schema = 'db')
Retrieving Records
# retrieve multiple records based on criteria
listOfContacts = contactService.queryMultiple(
limit = 100,
orderDictList = [
{
'field': {
'columnName': 'Firstname'
},
'direction': 'ASC'
}
]
)

# retreive multiple records from a query string
listOfContacts = contactService.queryMultipleByQueryString(
queryStr = 'select * from db.contacts order by Firstname desc'
)

# retrieve a single record by id
specificContact = contactService.querySingleById(id = 1)
Updating a Record
specificContact.firstname = 'this is a test'
specificContact.SaveChanges()
Creating a New Record
newContact = contactService.getNewInstance()
newContact.firstname = 'New'
newContact.lastname = 'Contact'
newContact.SaveChanges()
Deleting a Record
contactToDelete = contactService.querySingleById(id = 2)
contactToDelete.DeleteRecord()

For more information, refer to the Service Class method reference.

Dependencies

Refer to Getting Started/Install Dependencies

Supported Database Engines

Pikaview can work with and perform database operations of any of the following database engines :

  • MySQL
  • MSSQL
  • PostgresSQL

These databases are currently not supported, but plan to be included in a future update:

  • Oracle
  • Vertica

These lists are based on the database engines supported by pypika.