SHINSEGAE DataFabric Python Package
This is highly site dependent package. Resources are abstracted into package structure.
Usage
Get pandas dataframe from parquet file in hdfs
from pydatafabric.ye import parquet_to_pandas
pandas_df = parquet_to_pandas(hdfs_path)
Save pandas dataframe as parquet in hdfs
from pydatafabric.ye import get_spark
from pydatafabric.ye import pandas_to_parquet
spark = get_spark()
pandas_to_parquet(pandas_df, hdfs_path, spark) # we need spark for this operation
spark.stop()
Work with spark
from pydatafabric.ye import get_spark
spark = get_spark()
# do with spark session
spark.stop()
Work with spark-bigquery-connector
# SELECT
from pydatafabric.gcp import bq_table_to_pandas
pandas_df = bq_table_to_pandas("dataset", "table_name", ["col_1", "col_2"], "2020-01-01", "cust_id is not null")
# INSERT
from pydatafabric.gcp import pandas_to_bq_table
pandas_to_bq_table(pandas_df, "dataset", "table_name", "2022-02-22")
Send slack message
from pydatafabric.ye import slack_send
text = 'Hello'
username = 'airflow'
channel = '#leavemealone'
slack_send(text=text, username=username, channel=channel)
# Send dataframe as text
df = pd.DataFrame(data={'col1': [1, 2], 'col2': [3, 4]})
slack_send(text=df, username=username, channel=channel, dataframe=True)
Get bigquery client
from pydatafabric.gcp import get_bigquery_client
bq = get_bigquery_client(project="emart-datafabric")
bq.query(query)
IPython BigQuery Magic
from pydatafabric.gcp import import_bigquery_ipython_magic
import_bigquery_ipython_magic()
query_params = {
"p_1": "v_1",
"dataset": "common_dev",
}
%% bq --params $query_params
SELECT c_1
FROM {dataset}.user_logs
WHERE c_1 = @p_1
Use NES CLI
nes input_notebook_url -p k1 v1 -p k2 v2 -p k3 v3
Use github util
from pydatafabric.ye import get_github_util
g = get_github_util
# query graphql
res = g.query_gql(graph_ql)
# get file in github repository
byte_object = g.download_from_git(github_url_path)
Installation
$ pip install pydatafabric --upgrade
If you would like to install submodules for Emart Inc.
$ pip install pydatafabric[emart] --upgrade
Metadata
Release files for pydatafabric 0.4.41
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 |
|---|---|---|---|---|
| pydatafabric-0.4.41.tar.gz | 23.2 kB | Without provenance | Details for pydatafabric-0.4.41.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydatafabric-0.4.41-py3-none-any.whl | Python 3 | none | any | Details for pydatafabric-0.4.41-py3-none-any.whl |
Total release size: 48.4 kB
Release files / pydatafabric-0.4.41.tar.gz
| Download URL | pydatafabric-0.4.41.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ca65ad9db4a56424dd83678111eecf5ac389aad177a35cfbd54164fbd33b37b
|
|
BLAKE2b-256 checksum How to use checksums |
f526385c85117d139da20a7e4da85fce5fa8447f85cc8f4253a427956520c9f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / pydatafabric-0.4.41-py3-none-any.whl
| Download URL | pydatafabric-0.4.41-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2ab306f82c933e83eca81eadbc89c227bf072d3b83eddec1956f0be640a9de4
|
|
BLAKE2b-256 checksum How to use checksums |
b21defbba3859c2befb15d26b9b1b71acfeef0a40127b7a18e23e402a3d3b660
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for pydatafabric 0.4.41
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.