[go: up one dir, main page]

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

[sm] Add data exporter for ClickHouse in mdx file #4061

Merged

Conversation

shrutimantri
Copy link
Contributor

Description

Add data exporter for ClickHouse in mdx file
Related Slack thread: https://mageai.slack.com/archives/C03HTTWFEKE/p1700653736340409

How Has This Been Tested?

  • [ Yes ] tested by running the doc server locally

Checklist

  • [ Yes ] The PR is tagged with proper labels (bug, enhancement, feature, documentation)
  • [ Yes ] I have performed a self-review of my own code
  • [ N/A ] I have added unit tests that prove my fix is effective or that my feature works
  • [ N/A ] I have commented my code, particularly in hard-to-understand areas
  • [ N/A ] I have made corresponding changes to the documentation
  • [ N/A ] If new documentation has been added, relative paths have been added to the appropriate section of docs/mint.json

cc:

Specify your configuration settings in 'io_config.yaml'.

"""
database = 'database_name' # Specify the name of the schema to export data to
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using mage secrets to store this, for this example?

from mage_ai.data_preparation.decorators import data_exporter


class ClickHouse(ClickHouseParent):
Copy link
Member

Choose a reason for hiding this comment

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

you don't need to add this class if there's no customized logic in enter and exit methods.
Just do

ClickHouse.with_config(ConfigFileLoader(config_path, config_profile)).export(
....
)

in the method below

config_path = path.join(get_repo_path(), 'io_config.yaml')
config_profile = 'default'

with ClickHouse.with_config(ConfigFileLoader(config_path, config_profile)) as loader:
Copy link
Member

Choose a reason for hiding this comment

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

I mean you don't need with statement.
just do

ClickHouse.with_config(ConfigFileLoader(config_path, config_profile)).export(
...
)

Example: https://github.com/mage-ai/mage-ai/blob/master/mage_ai/data_preparation/templates/data_exporters/bigquery.py#L23

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it!

@wangxiaoyou1993 wangxiaoyou1993 merged commit 30d1503 into mage-ai:master Dec 5, 2023
@wangxiaoyou1993 wangxiaoyou1993 mentioned this pull request Dec 6, 2023
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants