Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

165 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDM Reader

pdm-datareader logo

Runs on Windows Runs on MacOS Runs on RHEL7 SCM Compliance PyPI - Version

pdm-datareader is a python package for querying Production Data Mart tables using SQL. The package handles authentication for end users with user impersonation, but also allows for inserting your own token. It must be run from Equinor managed environments connected to Equinor network.

Pull requests, feature requests and issues are welcomed using the GitHub Project Repository or as a ServiceNow ticket directed to Production Data Mart.

Install

  1. Ensure that ODBC Driver for SQL Server is installed. Currently supports both v18 and v17.
    This driver is bundled with the Microsoft SQL Client package in AccessIT, and should be pre installed on linux environments. Instructions for installing on MacOS can be found here..
  2. MacOS users must install unixodbc. See https://pypi.org/project/pyodbc/ for current instructions.
  3. Linux users must apply for Linux compliant device exclusion to get multifactor authentication to work.
  4. Finally install the latest version of the python package using:
    pip install pdm-datareader

Usage

See examples/demo.py or try the code below that queries PDM and retrieves data:

import datetime as dt
from pdm_datareader import query

# Example with parameter bindings to avoid SQL injection issues (recommended)
sql = '''
SELECT top(100) * 
FROM PDMVW.WELL_PROD_DAY 
WHERE COUNTRY = :countrycode 
AND PROD_DAY = :startdate
'''
df = query(sql, params={'countrycode': 'NO',
                 'startdate': dt.datetime(2022, 1, 1)})
print(df)

# Example without parameters (not recommended)
sql = 'SELECT TOP(1) * FROM PDMVW.WELL_PROD_DAY'
df = query(sql)
print(df)

About

A python package repository for enabling fast and efficient use of Production Data Mart through Python

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages