Skip to main content

A small python package to execute queries to PDM without having to re-authenticate every time

Project description

PDM Reader

pdm-datareader logo

Runs on Windows Runs on MacOS Runs on RHEL7 SCM Compliance

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdm_datareader-2.5.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

pdm_datareader-2.5.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pdm_datareader-2.5.0.tar.gz.

File metadata

  • Download URL: pdm_datareader-2.5.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for pdm_datareader-2.5.0.tar.gz
Algorithm Hash digest
SHA256 68c353bd15c6b51189d24c366b380b68b1eae9d6545dd97bd68ce55f890e58b1
MD5 cc082a0ac4e691b1e0598796c64eef7b
BLAKE2b-256 9fc3006bcbde85295523b0a10d97ed413d2a181ab5a7cd3e4e99dae6b157aee0

See more details on using hashes here.

File details

Details for the file pdm_datareader-2.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pdm_datareader-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76bf58d23b3ba18458ff4dc54aa502d720c2c0468eaf4f47e37203d0e223b121
MD5 46e4ded4b174b37075ac68aec2a90202
BLAKE2b-256 3531afa20e6db168307d59c3bba0dbcf115f255d39d68843ef3357dae1e47569

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page