eq-sql-connector
A small python package to handle authentication and act as a generic database connector.
It supports multiple authentication flows using msal-bearer and contains a few basic database access functions including parameterized querying.
Install
Install from pypi pip install eq-sql-connector or clone and use uv sync as a developer.
Usage
For connecting to Equinor database, typically only database and url_prod is required when creating DBConnector:
from eq_sql_connector import DBConnector
connector = DBConnector(
database="my_database",
url_prod="my-server.database.windows.net",
)
df = connector.query("SELECT TOP 5 * FROM my_table")
print(df)
# Example with parameterized querye+
df = connector.query(
"SELECT TOP 10 * FROM my_table WHERE asset_id IN :param",
params=[1001, 1002, 1003],
)
connector.reset_engine()
Advanced example with an explicit Authenticator and a parameterized query:
from msal_bearer import Authenticator
from eq_sql_connector import DBConnector
authenticator = Authenticator(
tenant_id="<your-tenant-id>",
client_id="<your-client-id>",
scopes=["https://database.windows.net/.default"],
user_name="<your-user>@equinor.com",
)
connector = DBConnector(
database="my_database",
url_prod="my-server.database.windows.net",
authenticator=authenticator,
)
df = connector.query(
"SELECT TOP 10 * FROM my_table WHERE asset_id IN :param",
params=[1001, 1002, 1003],
)
print(df.head())
# Dispose pooled connections when done
connector.reset_engine()
Testing
Run tests with coverage from the repository root:
uv run pytest --cov=src/eq_sql_connector --cov-report=term-missing
Current test suite covers:
- SQL driver detection and connection string generation
- Connector and DBConnector initialization and validation
- Query behavior (including parameter handling)
- Engine caching, reset, and pool configuration
Metadata
Release files for eq-sql-connector 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eq_sql_connector-1.0.2.tar.gz | 4.9 kB | Without provenance | Details for eq_sql_connector-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eq_sql_connector-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for eq_sql_connector-1.0.2-py3-none-any.whl |
Total release size: 10.5 kB
Release files / eq_sql_connector-1.0.2.tar.gz
| Download URL | eq_sql_connector-1.0.2.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe7e9cc336c6421005f50a138c4d1a68aa40d47d2bed57533e19f66bf8f68a1b
|
|
BLAKE2b-256 checksum How to use checksums |
5e78978fe89192fbccf246ee25650fa9f1465ec219de6202cadcd6ac2620c2d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.13.7 Darwin/27.2.0
|
Release files / eq_sql_connector-1.0.2-py3-none-any.whl
| Download URL | eq_sql_connector-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05163c9f0a257f975e02c832cbca65ce59f8a29f8ab6e18fed1dd55a65acd0bd
|
|
BLAKE2b-256 checksum How to use checksums |
b3542817fe442be8ca09e278271e26d3946c496dacdb5834b9b9d3c4317158c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.13.7 Darwin/27.2.0
|
Security for eq-sql-connector 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.