afl-ai-utils
rm -rf build dist
python3 setup.py sdist bdist_wheel
twine upload --repository pypi dist/*
Installation
pip install afl-ai-utils
Usage
Slack Alerting
from afl_ai_utils.slack_alerts import send_slack_alert
send_slack_alert(info_alert_slack_webhook_url=None, red_alert_slack_webhook_url=None, slack_red_alert_userids=None, payload=None, is_red_alert=False)
"""Send a Slack message to a channel via a webhook.
Args:
info_alert_slack_webhook_url(str): Infor slack channel url
red_alert_slack_webhook_url(str): red alert channel url
slack_red_alert_userids (list): userid's to mention in slack for red alert notification
payload (dict): Dictionary containing Slack message, i.e. {"text": "This is a test"}
is_red_alert (bool): Full Slack webhook URL for your chosen channel.
Returns:
HTTP response code, i.e. <Response [503]>
"""
BigQuery Dataframe to BigQuery and get result in Datafeame
def dump_dataframe_to_bq_table(self, dataframe: pd.DataFrame, schema_cols_type: dict, table_id: str, mode: str):
>>> from afl_ai_utils.bigquery_utils import BigQuery
>>> bq = BigQuery("keys.json")
>>> bq.write_insights_to_bq_table(dataframe=None, schema=None, table_id=None, mode=None)
"""Insert a dataframe to bigquery
Args:
dataframe(pandas dataframe): for dataframe to be dumped to bigquery
schema(BigQuery.Schema ): ex:
schema_cols_type: {"date_start":"date", "id": "integer", "name": "string"}
table_id (list): table_id in which dataframe need to be inserted e.g project_id.dataset.table_name = table_id
mode(str): To append or replace the table - e.g mode = "append" or mode="replace"
Returns:
returns as success message with number of inserted rows and table name
"""
Execute any query to BigQuery
def execute_query(self, query):
>>> from afl_ai_utils.bigquery_utils import BigQuery
>>> bq = BigQuery("keys.json")
>>> df = bq.execute_query(query = "SELECT * FROM TABLE")
"""
Args:
query (query of any type SELECT/INSERT/DELETE )
Returns:
returns dataframe of execute query result
"""
Metadata
Release files for afl-ai-utils 0.6.8
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 | |
|---|---|---|---|---|
| afl-ai-utils-0.6.8.tar.gz | 20.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| afl_ai_utils-0.6.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.9 kB
Release files / afl-ai-utils-0.6.8.tar.gz
| Download URL | afl-ai-utils-0.6.8.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
522681c6c13818ae32bc933fc14ebc97a93c23bdeae09a64b6f2cab876e99378
|
|
BLAKE2b-256 checksum How to use checksums |
d83b3abb9f4a88f8779a28fc348407109767d2b28c8c7510ade1187caaaf62e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Release files / afl_ai_utils-0.6.8-py3-none-any.whl
| Download URL | afl_ai_utils-0.6.8-py3-none-any.whl |
|---|---|
| Size | 24.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de777673c3f92ba5bb464a2ed82d10cf2b76b3cffef4631a1f507ef355a58342
|
|
BLAKE2b-256 checksum How to use checksums |
5c9515f0579257382b6fb007f56dd77d94fe06b0ffc801e827f2579409043b2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Security for afl-ai-utils 0.6.8
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.