Edward Best, CFA

Jan 26th, 2022


Displaying SQL Code That Defines Data Item’s Retrieval

In our recent blog “Intro to Qubles,” we discussed how Quotient leverages the respective strengths of Python and SQL to create a proprietary Python data container class that we call “Qubles.” For sourced data, we display the Python and SQL code that drive that the data retrieval under a tab labeled Definition.

For many data sources, the SQL query can be quite complex. In the case of fundamental data from Worldscope or Reuters Fundamentals from Refinitiv Quantitative Analytics (RQA), the SQL query can involve many data tables even for the simplest data item.

Users can access the SQL query that retrieves a specific data source data item. By selecting the Definition menu item, a user can choose between the Python base code in the Definition space or the Query space. The Query space displays the SQL code. Numerous SQL templates are used to form the basis of the specific SQL code.

In the case of last quarter’s sales ‘Sales_FQ’, an example of the first few lines from SQL query is shown below. This example has 448 lines of code. While some of these lines are documentation comments, most of these lines are SQL query code. Quotient greatly simplifies access to the data item and allows users to focus on factor construction and not complex SQL query building.