Skip to main content

QAPI SDK provides a library of classes for working with Query API in your Python code.

Project description

QAPI SDK

QAPI SDK provides a library of classes for working with Query API in your Python code.

Requirements

* Python 3.6+
* [python-dotenv](https://pypi.org/project/python-dotenv/)

Installation

pip install qapi_sdk 

Environment Variables

  • QAPI_URL: QAPI API URL
  • EMAIL: Your email

Examples

Query

  • FEED ID: The table must exist in Athena.
  • QUERY ID: The query id is used as an identifier for the query. Query id must be unique. Once you have retrieved your data from S3 it is advised to delete the query.
  • SQL: The SQL query to be executed.
import os
import time

from dotenv import load_dotenv

from qapi_sdk.logs import get_logger
from qapi_sdk import Query

load_dotenv()
ENV = os.getenv

logger = get_logger(os.path.basename(__file__))

# Step 1: Assign your FEED ID, QUERY ID, and SQL QUERY
feed_id = "[FEED/TABLE NAME]"
query_id = "[QUERY NAME]"
query = f"SELECT * FROM {feed_id}"

# Step 2: Create a Query object
my_query = Query(
    feed_id=feed_id,
    query_id=query_id
)

# Step 3: Execute the query push
my_query.push_query(sql=query)

# Step 4: Wait for the query to complete
while my_query.query_status():
    logger.info("Waiting for query to complete...")
    time.sleep(10)

# Step 5 (Optional): Delete the query
my_query.delete_query()

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

qapi-sdk-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

qapi_sdk-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file qapi-sdk-0.1.0.tar.gz.

File metadata

  • Download URL: qapi-sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.6.0

File hashes

Hashes for qapi-sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48e513007fa990ef7bb5b2a116929133b6c750021cb3324ebaeebc5854cb4131
MD5 247e868c519922144ab1d34240744b54
BLAKE2b-256 563cc67cf2bf97d06ac9cebe958efdcd5b48f050985ce5b0eee3f0196771779f

See more details on using hashes here.

File details

Details for the file qapi_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qapi_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.6.0

File hashes

Hashes for qapi_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c1812741116f9d4cf0d89f3d5524dcfff90b19d2b7ea0e7ca6e088484edb0e3
MD5 0f8c36a8ff90fbd5b7bd555a53d0a2a6
BLAKE2b-256 0c3d5fabb2a70c504a236ad6421d56faa140d001ef69cd6174c712204d1b435a

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