A small python package to execute queries to PDM without having to re-authenticate every time
Project description
PDM Reader
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
- 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.. - MacOS users must install unixodbc. See https://pypi.org/project/pyodbc/ for current instructions.
- Linux users must apply for Linux compliant device exclusion to get multifactor authentication to work.
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdm_datareader-2.5.1.tar.gz.
File metadata
- Download URL: pdm_datareader-2.5.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be6310200240eb0ecbfdd4165cb3f0a828a08005d1a04fe78db7ea550f6d280a
|
|
| MD5 |
f1b225d13405b9b7af461ec46e2b4823
|
|
| BLAKE2b-256 |
915ecf9572304338dddfacb7e814bfdf412a331981beba486a37252cce17cc4b
|
Provenance
The following attestation bundles were made for pdm_datareader-2.5.1.tar.gz:
Publisher:
cd.yml on equinor/pdm-datareader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pdm_datareader-2.5.1.tar.gz -
Subject digest:
be6310200240eb0ecbfdd4165cb3f0a828a08005d1a04fe78db7ea550f6d280a - Sigstore transparency entry: 177312037
- Sigstore integration time:
-
Permalink:
equinor/pdm-datareader@5d7e8ed267de20b038d22c7a48e4f76a169bdc25 -
Branch / Tag:
refs/tags/v2.5.1 - Owner: https://github.com/equinor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@5d7e8ed267de20b038d22c7a48e4f76a169bdc25 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pdm_datareader-2.5.1-py3-none-any.whl.
File metadata
- Download URL: pdm_datareader-2.5.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d356e0cf00adcc13afad8dbc23f2cf811594cae9b8a00652468a267fc520e175
|
|
| MD5 |
583ab7582d828ccc534220820488992a
|
|
| BLAKE2b-256 |
09cc10ea1374d299e14644836d9fb9295c2fc38d265dabaa28217b116d84eb0a
|
Provenance
The following attestation bundles were made for pdm_datareader-2.5.1-py3-none-any.whl:
Publisher:
cd.yml on equinor/pdm-datareader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pdm_datareader-2.5.1-py3-none-any.whl -
Subject digest:
d356e0cf00adcc13afad8dbc23f2cf811594cae9b8a00652468a267fc520e175 - Sigstore transparency entry: 177312040
- Sigstore integration time:
-
Permalink:
equinor/pdm-datareader@5d7e8ed267de20b038d22c7a48e4f76a169bdc25 -
Branch / Tag:
refs/tags/v2.5.1 - Owner: https://github.com/equinor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@5d7e8ed267de20b038d22c7a48e4f76a169bdc25 -
Trigger Event:
release
-
Statement type: