PyCoral, Python interface to CORAL By S.S.Tomar RRCAT, Indore, India.

Slides:



Advertisements
Similar presentations
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Advertisements

Oracle SQL Developer Data Modeler 3.0: Technical Overview March 2011.
Introduction to .NET Framework
Tahir Nawaz Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a.
COM vs. CORBA.
German Cancio – WP4 developments Partner Logo WP4-install plans WP6 meeting, Paris project conference
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System modeling 2.
OBJECT-ORIENTED PROGRAMMING. What is an “object”? Abstract entity that contains data and actions Attributes (characteristics) and methods (functions)
IS6112 Application Modelling and Design Introduction.
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 8 Slide 1 System models.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Microsoft ASP.NET AJAX - AJAX as it has to be Presented by : Rana Vijayasimha Nalla CSCE Grad Student.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
Femto Java Developing Java applications for tiny footprint platforms Eduard de Jong QC Technology B.V. BOF 2187
Fundamentals of Python: From First Programs Through Data Structures
The Re-engineering and Reuse of Software
SEAL V1 Status 12 February 2003 P. Mato / CERN Shared Environment for Applications at LHC.
The Design Discipline.
CORAL Database Copy Tools By Gitika Khare RRCAT, Indore, India.
Framework for Automated Builds Natalia Ratnikova CHEP’03.
An Object-Oriented Approach to Programming Logic and Design
Chapter 4 System Models A description of the various models that can be used to specify software systems.
Designing For Testability. Incorporate design features that facilitate testing Include features to: –Support test automation at all levels (unit, integration,
COM vs. CORBA Computer Science at Azusa Pacific University September 19, 2015 Azusa Pacific University, Azusa, CA 91702, Tel: (800) Department.
COSC 1P03 Data Structures and Abstraction 4.1 Abstract Data Types The advantage of a bad memory is that one enjoys several times the same good things for.
Codeigniter is an open source web application. It occupies a very small amount of space in the memory and is most useful for developers who aim to develop.
The Pipeline Processing Framework LSST Applications Meeting IPAC Feb. 19, 2008 Raymond Plante National Center for Supercomputing Applications.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
Python: Classes By Matt Wufsus. Scopes and Namespaces A namespace is a mapping from names to objects. ◦Examples: the set of built-in names, such as the.
Extending ArcGIS for Server
K. Harrison CERN, 20th April 2004 AJDL interface and LCG submission - Overview of AJDL - Using AJDL from Python - LCG submission.
Object-Oriented Frameworks for Migrating Structured Data April 2004.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
Interfacing Registry Systems December 2000.
LexBIG Release Overview Aug 21, LexBIG Context Project Goals for Sept –Incremental point release of LexBIG infrastructure to support EVS activities.
Nick Draper 05/11/2008 Mantid Manipulation and Analysis Toolkit for ISIS data.
Chapter 7 System models.
Andrew S. Budarevsky Adaptive Application Data Management Overview.
Software Engineering, 8th edition Chapter 8 1 Courtesy: ©Ian Somerville 2006 April 06 th, 2009 Lecture # 13 System models.
© 2006 IBM Corporation Agile Planning Web UI. © 2006 IBM Corporation Agenda  Overview of APT Web UI  Current Issues  Required Infrastructure  API.
_______________________________________________________________CMAQ Libraries and Utilities ___________________________________________________Community.
An Ontology-based Framework for Radiation Oncology Patient Management DL McShan 1, ML Kessler 1 and BA Fraass 2 1 University of Michigan Medical Center,
Framework for MDO Studies Amitay Isaacs Center for Aerospace System Design and Engineering IIT Bombay.
Netprog: Corba Object Services1 CORBA 2.0 Object Services Ref: The Essential Distributed Objects Survival Guide: Orfali, Harky & Edwards.
SEAL Core Libraries and Services CLHEP Workshop 28 January 2003 P. Mato / CERN Shared Environment for Applications at LHC.
The EDGeS project receives Community research funding 1 Porting Applications to the EDGeS Infrastructure A comparison of the available methods, APIs, and.
CERN - IT Department CH-1211 Genève 23 Switzerland t CORAL COmmon Relational Abstraction Layer Radovan Chytracek, Ioannis Papadopoulos (CERN.
Scenario-Based Analysis of Software Architecture Rick Kazman, Gregory Abowd, Len Bass, and Paul Clements Presented by Cuauhtémoc Muñoz.
TAKE – A Derivation Rule Compiler for Java Jens Dietrich, Massey University Jochen Hiller, TopLogic Bastian Schenke, BTU Cottbus/REWERSE.
Metadata By N.Gopinath AP/CSE Metadata and it’s role in the lifecycle. The collection, maintenance, and deployment of metadata Metadata and tool integration.
J.P. Wellisch, CERN/EP/SFT SCRAM Information on SCRAM J.P. Wellisch, C. Williams, S. Ashby.
Getting Started with.NET Getting Started with.NET/Lesson 1/Slide 1 of 31 Objectives In this lesson, you will learn to: *Identify the components of the.NET.
G.Govi CERN/IT-DB 1 September 26, 2003 POOL Integration, Testing and Release Procedure Integration  Packages structure  External dependencies  Configuration.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
IBM Global Services © 2005 IBM Corporation SAP Legacy System Migration Workbench| March-2005 ALE (Application Link Enabling)
The SEAL Component Model Radovan Chytracek CERN IT/DB, LCG AA On behalf of LCG/SEAL team This work received support from Particle Physics and Astronomy.
Introduction – ORM, Helloworld Application
CORAL CORAL a software system for vendor-neutral access to relational databases Ioannis Papadopoulos, Radoval Chytracek, Dirk Düllmann, Giacomo Govi, Yulia.
1 SWE Introduction to Software Engineering Lecture 14 – System Modeling.
Legacy Systems and Software Reuse CS 560. Economics Software is expensive.  Most software development makes extensive use of existing software.  Developers.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Software tools for digital LLRF system integration at CERN 04/11/2015 LLRF15, Software tools2 Andy Butterworth Tom Levens, Andrey Pashnin, Anthony Rey.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
Sergi Rubio Manrique “Archiving System at ALBA”. Tango Meeting. ALBA. October 16 th, MMVIII 1 Archiving ALBA Sergi Rubio Manrique.
POOL persistency framework for LHC
Object-Orientated Programming
Using ASIS to Generate C++ Bindings
Object-Oriented Programming
Presentation transcript:

PyCoral, Python interface to CORAL By S.S.Tomar RRCAT, Indore, India

What is it? PyCoral is an extension module of python, developed using the python/C API. It is a python interface to the CORAL package. PyCoral module implements python wrappers around a subset of CORAL specific C++ classes. It is one of the project in the framework of collaboration between RRCAT & CERN-IT- PSS/ LCG.

Why to use it? Write simple python scripts instead of complex C++ programs, for persistent storage/retrieval of your data in relational domain (Oracle, MySql, SQLite, Frontier)

Whom is it aimed at? “Command line administrators” for building CORAL API based tools using python scripts. For eg: the “Copy database tool” of the 3D project. Developers of Other tools of the 3D (Distributed Deployment of Databases) project.

How to use it? Start Python Interpreter. Example 1: import coral list1 = coral.AttributeList() OR from coral import * list1 = AttributeList()

Examples Example 2: import cPickle import coral w = coral.AttributeList() w.extend("h","blob") li1 = [] li2 = [] for j in range(1,500): li1.append(j) cPickle.dump(li1,h,1) li2 = cPickle.load(w[0].data()) OR li2 = cPickle.loads(w[0].data().readline())

Examples Example 3: cursor = query.execute() while (cursor.next()): // C++ style currentRow = cursor.currentRow() print str(currentRow) OR for currentRow in cursor: // Python style print str(currentRow) OR for currentRow in query.execute(): print str(currentRow)

Examples Example 4: cmp(list1,list2) print str(attList1) attrList[0].setData(None) attrList['X'].setData(None) print attrList[0].data() for attribute in attrList: print attribute.data()

Implementation Details Choice of Python/C API Selection of the subset of CORAL classes Factoring of Code Exposed and Unexposed classes Exception Handling Parent Child relationship BLOB implementation “Attribute in AttributeList” implementation Inheritance implementation Testing techniques

Choice of Python/C API Boost::Python considered. Advantages of Python/C API  No external dependency except python client libraries.  Python style and semantics is easier to implement.  Although more coding but straightforward one, mostly related to struct initializations  No change required in the underlying C++ code.

Python style & Semantics For Templated methods in CORAL, Type checking is performed in the wrapper methods, which preserves the loosely-typed semantics of Python. Blob, implemented using the buffer interface feature in python. Pickling support for writing and reading python objects into BLOB.

…(Contd) AttributeList & Cursor with iterator protocol: for attribute in attributeList: print attribute.data() Comparison of two Attributes or AttributeLists using “cmp” command. String representation of Attribute or AttributeList using “str” command.

Selection of a subset of CORAL classes All CoralBase/RelationalAccess except:  Exception classes.  Developer level interfaces (IRelationalService, ISession, IAuthenticationService, ILookupService etc…)

…Contd No 1-1 mapping of methods, to maintain python style (for eg: templated methods, size & toOutputStream not implemented as is)

Factoring of Code Based on code classification Module Naming and Initialization part of the code Various structure definitions like, class related PyTypeObject structures, normal method structures, mapping methods & buffer structure part of code. Init and dealloc methods of the classes. Various other method related code as required by specific classes in the interfaces. Exposed & Unexposed Classes Exposed classes, header files in PyCoral subdir. Unexposed classes & other code in src subdir.

Exposed & Unexposed classes Exposed ones can be used by other extension modules, Can be instantiated by the python programmer, Are AttributeList, Date, Blob, TimeStamp, TableDescription, Context, ConnectionService & Exception. Unexposed class objects can only be created using some functions in the exposed classes & already created unexposed class objects.

Exception Handling All C++ exceptions generated by CORAL classes and methods are caught & thrown in the methods of the PyCoral and can be caught further in the python code. Wrappers not created for Exception classes and its hierarchy in CORAL package.

Parent Child relationship Must to implement, because of exposed & unexposed class implementation. Helps in keeping track of the chain of objects created using the methods of the exposed classes. Tracking required for performing “dealloc” of objects in reverse order when the object that created it goes out of scope.

BLOB implementation By using the buffer protocol, which allows its reading and writing as a buffer without additional memory requirement. Pickling support, for reading and writing python objects into and from BLOB.

“Attribute in AttributeList” Implementation Python style for-in loop. Iterator protocol implementation.  Iter() method for AttributeList class.  Iter() & next() for AttributeListIterator class. Allows following two forms of iterations: It = iter(AttList1) For i in it: print i.data() For attribute in AttList1: print attribute.data()

Inheritance implementation Single Inheritance  IQuery & IQueryDefinition  IBulkOperationWithQuery & IBulkOperation  IViewFactory & IQueryDefinition Multiple Inheritance  TableDescription, ITableDescription, ISchemaEditor classes

…Contd Whenever a class inheriting from a base class is “init” ed, all the classes (base classes + inheriting) are initialized. Whenever the inheriting class object goes out of scope its “dealloc” method, DECREFs all the base classes. The parent of the base classes have to be Py_NONE, to take care of the parent child implementation, which exists in all the classes.

Testing Techniques RefCounting  Requires Python recompilation with DEBUG option.  Carried out for all unit tests and integration test code. Valgrind memcheck  Only carried out for all the CoralBase classes and methods.  Not possible for RelationalAccess because of presence of SEAL code.

Present Status & Future The first release of PyCoral was made along with CORAL release Subsequent releases of CORAL will all have PyCoral release also.

Conclusion Python/C API technique, provides an easy way to pythonize C++ classes, allowing both the python style and semantics, to be incorporated, without changing the underlying C++ code.

Thank You all….