-
Notifications
You must be signed in to change notification settings - Fork 8
Build data ingestion infrastructure for Databricks notebook #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Review SummaryStyle Reference: Python Style Guide (getml/code17-northstar#18) Context: Requirements from #42This PR implements Databricks ingestion, mirroring the pattern established in #42 (Build data preparation infrastructure for feature store notebooks). Issue #42 defines the expected architecture: Expected usage pattern from #42: from integration.{platform}.data import ingestion, preparation
ingestion.load_from_gcs(
bucket="gs://static.getml.com/datasets/jaffle-shop/",
destination_schema="RAW"
)The key expectation: data warehouses/platforms should use their native capabilities to ingest from GCS - not download through Python. Critical Deviation: ArchitectureThe current implementation downloads parquet files to local memory via
Correct approach: # Spark reads parquet directly from URL - no local memory needed
spark.read.parquet(source_url).write.format("delta").saveAsTable(target_table)Deviations from #42 Structure
Issues SummaryCritical (blocking):
High priority:
Medium priority:
Recommended Changes
|
|
@srnnkls I am done with my responses to your previous comments. Please have a look. |
srnnkls
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid code overall. Nothing blocking, mostly style and minor suggestions.
srnnkls
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One blocking issue: remove the os.environ mutation at line 168. The rest are minor suggestions.
@srnnkls I have addressed both the blocking issue and the minor suggestions. Have a look again. |
| def _validate_sql_identifier(value: str) -> str: | ||
| """ | ||
| Validate SQL identifier to prevent injection attacks. | ||
|
|
||
| Args: | ||
| value: Identifier to validate. | ||
|
|
||
| Returns: | ||
| The validated identifier. | ||
|
|
||
| Raises: | ||
| ValueError: If identifier contains invalid characters. | ||
| """ | ||
| if not _IDENTIFIER_PATTERN.fullmatch(value): | ||
| msg = ( | ||
| f"Invalid SQL identifier {value!r}. " | ||
| f"Must match pattern: {_IDENTIFIER_PATTERN.pattern!r}" | ||
| ) | ||
| raise ValueError(msg) | ||
|
|
||
| return value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from typing import Annotated
from sqlglot import exp
from pydantic import AfterValidator
def _quote_identifier(raw_identifier: str, dialect: str = "databricks") -> str:
return exp.to_identifier(raw_identifier).sql(dialect=dialect)
SqlIdentifier = Annotated[str, AfterValidator(_quote_identifier)]There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added: bcbc393
|
@srnnkls have a look again. |
Closes: #50 & #52