From 0436e7a14cd16ada3c9709ab57ba6a07c8cf74dd Mon Sep 17 00:00:00 2001 From: Erik Erlandson Date: Thu, 28 Oct 2021 15:19:50 -0700 Subject: [PATCH] add examples --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/README.md b/README.md index 38c8bca..4f5a9d2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,63 @@ # osc-ingest-tools python tools to assist with standardized data ingestion workflows +### Install from PyPi + +``` +pip install osc-ingest-tools +``` + +### Examples + +```python +>>> from osc_ingest_trino import * + +>>> import pandas as pd + +>>> data = [['tom', 10], ['nick', 15], ['juli', 14]] + +>>> df = pd.DataFrame(data, columns = ['First Name', 'Age In Years']).convert_dtypes() + +>>> df + First Name Age In Years +0 tom 10 +1 nick 15 +2 juli 14 + +>>> enforce_sql_column_names(df) + first_name age_in_years +0 tom 10 +1 nick 15 +2 juli 14 + +>>> enforce_sql_column_names(df, inplace=True) + +>>> df + first_name age_in_years +0 tom 10 +1 nick 15 +2 juli 14 + +>>> df.info(verbose=True) + +RangeIndex: 3 entries, 0 to 2 +Data columns (total 2 columns): + # Column Non-Null Count Dtype +--- ------ -------------- ----- + 0 first_name 3 non-null string + 1 age_in_years 3 non-null Int64 +dtypes: Int64(1), string(1) +memory usage: 179.0 bytes + +>>> p = create_table_schema_pairs(df) + +>>> print(p) + first_name varchar, + age_in_years bigint + +>>> +``` + ### python packaging resources - https://packaging.python.org/