local-data-platform 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- local_data_platform-0.1.0/PKG-INFO +22 -0
- local_data_platform-0.1.0/README.md +9 -0
- local_data_platform-0.1.0/local_data_platform/__init__.py +0 -0
- local_data_platform-0.1.0/local_data_platform/catalog/__init__.py +0 -0
- local_data_platform-0.1.0/local_data_platform/catalog/__pycache__/__init__.cpython-312.pyc +0 -0
- local_data_platform-0.1.0/local_data_platform/catalog/__pycache__/sql.cpython-312.pyc +0 -0
- local_data_platform-0.1.0/local_data_platform/catalog/sql.py +10 -0
- local_data_platform-0.1.0/local_data_platform/catalog.py +27 -0
- local_data_platform-0.1.0/local_data_platform/download.py +22 -0
- local_data_platform-0.1.0/local_data_platform/entity_class.py +0 -0
- local_data_platform-0.1.0/local_data_platform/hello_world.py +2 -0
- local_data_platform-0.1.0/local_data_platform/pipelines/__init__.py +17 -0
- local_data_platform-0.1.0/local_data_platform/pipelines/python/__init__.py +0 -0
- local_data_platform-0.1.0/local_data_platform/pipelines/python/base_pipeline.py +10 -0
- local_data_platform-0.1.0/local_data_platform/pipelines/python/ingestion/__init__.py +0 -0
- local_data_platform-0.1.0/local_data_platform/pipelines/python/ingestion/create_table.py +3 -0
- local_data_platform-0.1.0/local_data_platform/source/__init__.py +0 -0
- local_data_platform-0.1.0/local_data_platform/source/base_source.py +18 -0
- local_data_platform-0.1.0/local_data_platform/source/parquet/__init__.py +0 -0
- local_data_platform-0.1.0/local_data_platform/source/parquet/read.py +21 -0
- local_data_platform-0.1.0/local_data_platform/tmp/warehouse/pyiceberg_catalog.db +0 -0
- local_data_platform-0.1.0/pyproject.toml +16 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: local-data-platform
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary:
|
|
5
|
+
Author: Tushar Choudhary
|
|
6
|
+
Author-email: 151359025+tusharchou@users.noreply.github.com
|
|
7
|
+
Requires-Python: >=3.12,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Requires-Dist: pyarrow (>=17.0.0,<18.0.0)
|
|
11
|
+
Requires-Dist: pyiceberg (>=0.7.1,<0.8.0)
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Poetry Documentation
|
|
15
|
+
|
|
16
|
+
`cd local-data-platform`
|
|
17
|
+
|
|
18
|
+
`poetry init`
|
|
19
|
+
|
|
20
|
+
`poetry install`
|
|
21
|
+
|
|
22
|
+
`poetry run python hello_world`
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pyiceberg.catalog.sql import SqlCatalog
|
|
3
|
+
|
|
4
|
+
class LocalCatalog(SqlCatalog):
|
|
5
|
+
|
|
6
|
+
def __init__(self, name: str, **properties: str):
|
|
7
|
+
super().__init__(name, **properties)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Define the warehouse path
|
|
12
|
+
warehouse_path = "./tmp/warehouse"
|
|
13
|
+
|
|
14
|
+
# Ensure the directory exists
|
|
15
|
+
os.makedirs(warehouse_path, exist_ok=True)
|
|
16
|
+
|
|
17
|
+
# Set up the SQL catalog using SQLite and the defined warehouse path
|
|
18
|
+
catalog = SqlCatalog(
|
|
19
|
+
"pyiceberg_catalog_db",
|
|
20
|
+
**{
|
|
21
|
+
"uri": f"sqlite:///{warehouse_path}/pyiceberg_catalog.db", # Ensure .db file extension
|
|
22
|
+
"warehouse": f"file://{warehouse_path}",
|
|
23
|
+
},
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Verify if the catalog is set up correctly
|
|
27
|
+
print("Catalog set up successfully:", catalog)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import pyarrow.parquet as pq
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
#
|
|
6
|
+
# response = requests.get(
|
|
7
|
+
# 'https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2023-01.parquet',
|
|
8
|
+
# )
|
|
9
|
+
#
|
|
10
|
+
#
|
|
11
|
+
# if response.status_code == 200:
|
|
12
|
+
# with open("/tmp/yellow_tripdata_2023-01.parquet", "w") as f:
|
|
13
|
+
# f.write(response.content)
|
|
14
|
+
|
|
15
|
+
df = pq.read_table("/tmp/yellow_tripdata_2023-01.parquet")
|
|
16
|
+
|
|
17
|
+
catalog.create_namespace("nyc_taxi")
|
|
18
|
+
|
|
19
|
+
table = catalog.create_table(
|
|
20
|
+
"nyc_taxi.taxi_dataset",
|
|
21
|
+
schema=df.schema,
|
|
22
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from abc import ABC
|
|
2
|
+
|
|
3
|
+
class SourceFile(ABC):
|
|
4
|
+
"""
|
|
5
|
+
A base class for SourceFile implementation
|
|
6
|
+
|
|
7
|
+
Args:
|
|
8
|
+
location (str): A URI or a path to a local file
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
location (str): The path to SourceFile instance
|
|
12
|
+
exists (boo): w
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
_name: str
|
|
16
|
+
|
|
17
|
+
def __init__(self, location: str):
|
|
18
|
+
self
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import pyarrow.parquet as pq
|
|
3
|
+
|
|
4
|
+
SAMPLE_PARQUET = os.path.abspath('/Users/tushar/PycharmProjects/local-data-platform/local-data-platform/sample_data/nyc_yellow_taxi/parquet/2023-01/yellow_tripdata_2023-01.parquet')
|
|
5
|
+
|
|
6
|
+
# cwd_path = os.getcwd()
|
|
7
|
+
# print(type(cwd_path))
|
|
8
|
+
# print(cwd_path)
|
|
9
|
+
# print(SAMPLE_PARQUET)
|
|
10
|
+
# # print(path)
|
|
11
|
+
# print(__file__)
|
|
12
|
+
# print(os.path.dirname(__file__))
|
|
13
|
+
# print(os.path.realpath(os.path.dirname(__file__)))
|
|
14
|
+
# print(os.path.realpath(path))
|
|
15
|
+
# real_path = os.path.realpath(path)
|
|
16
|
+
# print("File exists:", os.path.exists(SAMPLE_PARQUET))
|
|
17
|
+
# print("File exists:", os.path.exists(cwd_path))
|
|
18
|
+
# print(cwd_path)
|
|
19
|
+
df = pq.read_table(SAMPLE_PARQUET)
|
|
20
|
+
#
|
|
21
|
+
print(df.get_total_buffer_size())
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "local-data-platform"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = ""
|
|
5
|
+
authors = ["Tushar Choudhary <151359025+tusharchou@users.noreply.github.com>"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
|
|
8
|
+
[tool.poetry.dependencies]
|
|
9
|
+
python = "^3.12"
|
|
10
|
+
pyiceberg = "^0.7.1"
|
|
11
|
+
pyarrow = "^17.0.0"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = ["poetry-core"]
|
|
16
|
+
build-backend = "poetry.core.masonry.api"
|