This release is a pre-release and may not be stable for production use.
AWS Glue / PySpark QuestDB writer
A simple writing utility for writing to QuestDB from PySpark / AWS Glue
#Introduction A very simple convenience library created due to difficulty in getting custom builds of the AWS Glue Libs for AWS for local development. The standard release is Python 3.6 and requires some changes to be made in order to add in extra libraries.
The InfluxDB writer is a potential alternative to this, but I didn't have much of a chance to get it working due to dependencies and it not easily supporting PySpark.
#Installation
Install this via pip
pip3 install awsglue-questdb-writer
#Usage
In your AWS Glue / PySpark Job include the file via
from awsglue_questdb_writer import *
Usage is by passing a DF to the function, this should ideally be a DF from a SparkSQL output like Glue creates (e.g. from the from_catalog) as that is what has been tested.
Important to note:
- All Timestamps must be datetime objects
- Nanosecond precision (required by QuestDB) is currently only your timestamp precision with added zeros
- If you need real nanosecond permission you must be on Python 3.7 and update the library to use it (See comments)
- QuestDB is whitespace sensitive, all datetimes are quoted but any other fields with whitespace will cause this to fail (silently)
- There is no socket response from this library (it is designed to be unmonitored and high throughput) - if errors are in your input it will fail silently (PR's welcome)
- There is a convenience line to drop unwanted fields prior to passing this into the function to write to QuestDB
args = getResolvedOptions(sys.argv,
['TempDir', 'JOB_NAME', 'db_name', 'temp_workflow_bucket', 'questdb_host', 'questdb_port'])
sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)
job.init(args['JOB_NAME'], args)
allDaily = glueContext.create_dynamic_frame.from_catalog(database=args['db_name'],
table_name="daily",
transformation_ctx="allDaily",
)
df = allDaily.toDF()
tdf = df.withColumn('reading_date_time', F.to_timestamp(df['reading_date_time'], '%Y-%m-%dT%H:%M:%S.%f'))
tdf = tdf.drop(*["ingestion_date", "period_start", "period_end", "quality_method",
"event", "import_reactive_total", "export_reactive_total"])
write_to_quest(df=tdf, measurement="meter_id", table="daily", timestamp_field="reading_date_time", args=args)
job.commit()
#License See LICENSE for full details
Metadata
Release files for awsglue-questdb-writer 0.0.1a0
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 | |
|---|---|---|---|---|
| awsglue-questdb-writer-0.0.1a0.tar.gz | 4.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| awsglue_questdb_writer-0.0.1a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.8 kB
Release files / awsglue-questdb-writer-0.0.1a0.tar.gz
| Download URL | awsglue-questdb-writer-0.0.1a0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f2a840d33a8fbce3cecfffe0e4b0888c77ad144e52789acc3e6749313eec717
|
|
BLAKE2b-256 checksum How to use checksums |
3b5b5dfb925258013117b8079abba5d89a54f7cb1f9545cf73f84a2ac55ac49d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10
|
Release files / awsglue_questdb_writer-0.0.1a0-py3-none-any.whl
| Download URL | awsglue_questdb_writer-0.0.1a0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bcca87f4fa26b7b1cc0bc68efe641b154af5ef80828db64db7afadcdd1aa03cf
|
|
BLAKE2b-256 checksum How to use checksums |
a8c8d83cd50fa6fcd4839c9e134a54b96f87150589237dfde7d15b6fa34062a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10
|
Security for awsglue-questdb-writer 0.0.1a0
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.