Skip to content
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

[DO NOT MERGE] - Sap hana improvements #11133

Draft
wants to merge 52 commits into
base: master
Choose a base branch
from

Conversation

acrylJonny
Copy link
Contributor

@acrylJonny acrylJonny commented Aug 9, 2024

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

Summary by CodeRabbit

  • New Features

    • Enhanced metadata ingestion support for SAP HANA databases, including new configuration options for improved flexibility.
    • Introduced methods to retrieve detailed information about views and their lineage, enhancing data visibility.
    • Implemented concurrent processing for better performance during metadata ingestion.
  • Bug Fixes

    • Improved handling of various data types and structures specific to HANA to ensure accurate metadata capture.

Copy link
Contributor

coderabbitai bot commented Aug 9, 2024

Walkthrough

The recent changes to the hana.py module significantly enhance metadata ingestion from SAP HANA databases. Key improvements include new configurations for database patterns and types, alongside methods for detailed view and lineage information. Additionally, concurrent processing has been introduced, optimizing performance during metadata capture. Overall, these updates expand the module's capabilities while ensuring accurate reporting of HANA-specific data structures.

Changes

File Path Change Summary
metadata-ingestion/src/datahub/ingestion/source/sql/hana.py - Added BaseHanaConfig class and enhanced HanaConfig class with new fields.
- Introduced new functions for SAP type processing and view metadata retrieval.
- Enhanced methods for processing tables, views, and calculation views.
- Implemented concurrent processing for better performance.

Poem

In the land of code where changes bloom,
A rabbit hops with joy, dispelling gloom.
New configs and types, oh what a delight,
Metadata dances, taking flight! 🐇✨
With threads at work, the speed takes flight,
HANA’s secrets revealed, shining bright!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added ingestion PR or Issue related to the ingestion of metadata community-contribution PR or Issue raised by member(s) of DataHub Community labels Aug 9, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 78336c9 and 9b9ec6c.

Files selected for processing (1)
  • metadata-ingestion/src/datahub/ingestion/source/sql/hana.py (3 hunks)
Additional context used
Ruff
metadata-ingestion/src/datahub/ingestion/source/sql/hana.py

242-245: f-string without any placeholders

Remove extraneous f prefix

(F541)


250-256: f-string without any placeholders

Remove extraneous f prefix

(F541)

Additional comments not posted (16)
metadata-ingestion/src/datahub/ingestion/source/sql/hana.py (16)

1-45: Imports look good.

The imports are relevant to the new functionalities introduced in the file.


62-94: Type mapping is well-defined.

The HANA_TYPES_MAP provides a comprehensive mapping of HANA data types to DataHub schema classes.


97-99: Preprocessing function is effective.

The preprocess_sap_type function effectively removes parameters from SAP type strings using regex.


102-104: Type conversion function is efficient.

The get_pegasus_type function efficiently converts SAP types to DataHub schema classes using the preprocessing and mapping.


107-115: Configuration class is well-structured.

The BaseHanaConfig class appropriately extends BasicSQLAlchemyConfig with HANA-specific configurations.


118-129: Extended configuration class is appropriate.

The HanaConfig class extends BaseHanaConfig with additional fields for database filtering, enhancing flexibility.


143-159: Constructor setup is correct.

The __init__ method correctly initializes the SqlParsingAggregator and sets up the SQL engine.


169-171: Engine creation method is straightforward.

The _create_engine method is essential for establishing database connectivity.


173-175: Table properties retrieval is valuable.

The get_table_properties method effectively retrieves table metadata, aiding in documentation and understanding.


177-187: View properties retrieval is efficient.

The get_view_properties method efficiently fetches view details necessary for metadata ingestion.


189-199: View info organization is effective.

The get_view_info method organizes view metadata into a DatasetPropertiesClass, aiding in structured data management.


201-208: Lineage retrieval is crucial.

The get_lineage method efficiently retrieves lineage information, which is essential for understanding data dependencies.


210-227: Lineage construction is well-structured.

The construct_lineage method organizes upstream data into an UpstreamLineageClass, aiding in lineage management.


229-239: Column metadata retrieval is efficient.

The get_columns method efficiently gathers column metadata, which is crucial for schema management.


467-501: Calculation view lineage extraction is effective.

The get_calculation_view_lineage method effectively extracts lineage information from XML, aiding in understanding calculation view dependencies.


505-572: Calculation view processing is comprehensive.

The _process_calculation_view method effectively handles the ingestion and processing of calculation view metadata.

Comment on lines 241 to 245
def get_query_logs(self) -> List[Dict]:
query = f"""
SELECT STATEMENT_STRING,
USER_NAME, LAST_EXECUTION_TIMESTAMP
FROM SYS.M_SQL_PLAN_CACHE"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary f-string.

The query string does not require an f-string since there are no placeholders.

-        query = f"""
+        query = """
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def get_query_logs(self) -> List[Dict]:
query = f"""
SELECT STATEMENT_STRING,
USER_NAME, LAST_EXECUTION_TIMESTAMP
FROM SYS.M_SQL_PLAN_CACHE"""
def get_query_logs(self) -> List[Dict]:
query = """
SELECT STATEMENT_STRING,
USER_NAME, LAST_EXECUTION_TIMESTAMP
FROM SYS.M_SQL_PLAN_CACHE"""
Tools
Ruff

242-245: f-string without any placeholders

Remove extraneous f prefix

(F541)

Comment on lines 249 to 256
def get_package_names(self) -> List[dict]:
query = f"""
SELECT
PACKAGE_ID,
OBJECT_NAME,
CDATA
FROM _SYS_REPO.ACTIVE_OBJECT
WHERE OBJECT_SUFFIX='calculationview'"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary f-string.

The query string does not require an f-string since there are no placeholders.

-        query = f"""
+        query = """
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def get_package_names(self) -> List[dict]:
query = f"""
SELECT
PACKAGE_ID,
OBJECT_NAME,
CDATA
FROM _SYS_REPO.ACTIVE_OBJECT
WHERE OBJECT_SUFFIX='calculationview'"""
def get_package_names(self) -> List[dict]:
query = """
SELECT
PACKAGE_ID,
OBJECT_NAME,
CDATA
FROM _SYS_REPO.ACTIVE_OBJECT
WHERE OBJECT_SUFFIX='calculationview'"""
Tools
Ruff

250-256: f-string without any placeholders

Remove extraneous f prefix

(F541)

@acrylJonny acrylJonny changed the title Sap hana improvements [DO NOT MERGE] - Sap hana improvements Aug 9, 2024
@hsheth2
Copy link
Collaborator

hsheth2 commented Oct 31, 2024

@acrylJonny marking this as a draft PR until it's ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution PR or Issue raised by member(s) of DataHub Community ingestion PR or Issue related to the ingestion of metadata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants