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.
Files changed (22) hide show
  1. local_data_platform-0.1.0/PKG-INFO +22 -0
  2. local_data_platform-0.1.0/README.md +9 -0
  3. local_data_platform-0.1.0/local_data_platform/__init__.py +0 -0
  4. local_data_platform-0.1.0/local_data_platform/catalog/__init__.py +0 -0
  5. local_data_platform-0.1.0/local_data_platform/catalog/__pycache__/__init__.cpython-312.pyc +0 -0
  6. local_data_platform-0.1.0/local_data_platform/catalog/__pycache__/sql.cpython-312.pyc +0 -0
  7. local_data_platform-0.1.0/local_data_platform/catalog/sql.py +10 -0
  8. local_data_platform-0.1.0/local_data_platform/catalog.py +27 -0
  9. local_data_platform-0.1.0/local_data_platform/download.py +22 -0
  10. local_data_platform-0.1.0/local_data_platform/entity_class.py +0 -0
  11. local_data_platform-0.1.0/local_data_platform/hello_world.py +2 -0
  12. local_data_platform-0.1.0/local_data_platform/pipelines/__init__.py +17 -0
  13. local_data_platform-0.1.0/local_data_platform/pipelines/python/__init__.py +0 -0
  14. local_data_platform-0.1.0/local_data_platform/pipelines/python/base_pipeline.py +10 -0
  15. local_data_platform-0.1.0/local_data_platform/pipelines/python/ingestion/__init__.py +0 -0
  16. local_data_platform-0.1.0/local_data_platform/pipelines/python/ingestion/create_table.py +3 -0
  17. local_data_platform-0.1.0/local_data_platform/source/__init__.py +0 -0
  18. local_data_platform-0.1.0/local_data_platform/source/base_source.py +18 -0
  19. local_data_platform-0.1.0/local_data_platform/source/parquet/__init__.py +0 -0
  20. local_data_platform-0.1.0/local_data_platform/source/parquet/read.py +21 -0
  21. local_data_platform-0.1.0/local_data_platform/tmp/warehouse/pyiceberg_catalog.db +0 -0
  22. 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`
@@ -0,0 +1,9 @@
1
+ # Poetry Documentation
2
+
3
+ `cd local-data-platform`
4
+
5
+ `poetry init`
6
+
7
+ `poetry install`
8
+
9
+ `poetry run python hello_world`
@@ -0,0 +1,10 @@
1
+ from pyiceberg.catalog.sql import SqlCatalog
2
+
3
+ class LocalCatalog(SqlCatalog):
4
+
5
+ def __init__(self, name: str, **properties: str):
6
+ # Set up the SQL catalog using SQLite and the defined warehouse path
7
+ super().__init__(name, **properties)
8
+
9
+
10
+
@@ -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
+ )
@@ -0,0 +1,2 @@
1
+ def hello_world():
2
+ print("Hello, world")
@@ -0,0 +1,17 @@
1
+ from abc import ABC
2
+
3
+ class Pipelines(ABC):
4
+ source: str
5
+ target: str
6
+
7
+ def __init__(self):
8
+ pass
9
+
10
+ def extract(self):
11
+ pass
12
+
13
+ def transform(self):
14
+ pass
15
+
16
+ def load(self):
17
+ pass
@@ -0,0 +1,10 @@
1
+ class BasePipeline():
2
+ source
3
+ target
4
+ def extract(self):
5
+ pass
6
+
7
+ def transform(self):
8
+ pass
9
+ def load(self):
10
+ pass
@@ -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
@@ -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"