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+
* Must be logged into the private VPN. 

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 time

from dotenv import load_dotenv

from qapi_sdk import Query

load_dotenv()

# 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():
    print("Waiting for query to complete...")
    time.sleep(10)

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

CHANGELOG

[Unreleased]

  • Add --help option to query.py
  • Add push.py to qapi-sdk package to push data to Athena

[0.1.4] - 2022-05-29

  • Added the CHANGELOG section.
  • Updated README.md

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.5.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

qapi_sdk-0.1.5-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qapi-sdk-0.1.5.tar.gz
  • Upload date:
  • Size: 3.8 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.5.tar.gz
Algorithm Hash digest
SHA256 687f7366f59851f5fa2e866b425de9e9bbe39ab18ac1b1efa798b22e18528f8c
MD5 b5ea63ef9cdb923a93719f9cdc9cab28
BLAKE2b-256 65e8426d7f9853bb2841e147c6c4860943aafc621ea132527d373eabfacbcb46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qapi_sdk-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c777b4977eb9234d9681cbde296d15690341a97d7cfb75a501c691a06b12f9d1
MD5 617888689d5699c4557356a620fbc4a1
BLAKE2b-256 a3d31887eda16bc991601afda9fd849e2abaf4c16e7fe2ad6d37b35354e0e66d

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