Skip to content

Commit 0436e7a

Browse files
committed
add examples
1 parent 749b5bf commit 0436e7a

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

README.md

+57
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,63 @@
11
# osc-ingest-tools
22
python tools to assist with standardized data ingestion workflows
33

4+
### Install from PyPi
5+
6+
```
7+
pip install osc-ingest-tools
8+
```
9+
10+
### Examples
11+
12+
```python
13+
>>> from osc_ingest_trino import *
14+
15+
>>> import pandas as pd
16+
17+
>>> data = [['tom', 10], ['nick', 15], ['juli', 14]]
18+
19+
>>> df = pd.DataFrame(data, columns = ['First Name', 'Age In Years']).convert_dtypes()
20+
21+
>>> df
22+
First Name Age In Years
23+
0 tom 10
24+
1 nick 15
25+
2 juli 14
26+
27+
>>> enforce_sql_column_names(df)
28+
first_name age_in_years
29+
0 tom 10
30+
1 nick 15
31+
2 juli 14
32+
33+
>>> enforce_sql_column_names(df, inplace=True)
34+
35+
>>> df
36+
first_name age_in_years
37+
0 tom 10
38+
1 nick 15
39+
2 juli 14
40+
41+
>>> df.info(verbose=True)
42+
<class 'pandas.core.frame.DataFrame'>
43+
RangeIndex: 3 entries, 0 to 2
44+
Data columns (total 2 columns):
45+
# Column Non-Null Count Dtype
46+
--- ------ -------------- -----
47+
0 first_name 3 non-null string
48+
1 age_in_years 3 non-null Int64
49+
dtypes: Int64(1), string(1)
50+
memory usage: 179.0 bytes
51+
52+
>>> p = create_table_schema_pairs(df)
53+
54+
>>> print(p)
55+
first_name varchar,
56+
age_in_years bigint
57+
58+
>>>
59+
```
60+
461
### python packaging resources
562

663
- https://packaging.python.org/

0 commit comments

Comments
 (0)