Introducing Keboola Shared Code

Simplify Code Updates with Shared Code

Easily maintain consistency and eliminate errors by reusing code blocks across multiple transformations.
Try Keboola Now
Arrow right
Laptop displaying Keboola data platform dashboard showing usage metrics and welcome screen

Understanding Shared Code in Keboola: Comprehensive Guide

Managing complex data transformations typically involves repeating similar or identical code across multiple transformations. This practice can quickly become cumbersome, error-prone, and difficult to maintain, especially when updates or changes are required. Keboola addresses these challenges effectively with its powerful Shared Code feature. This comprehensive guide provides a deep insight into what shared code is, how it works, and practical examples of its usage.

What is Shared Code in Keboola?

Shared code in Keboola allows users to define code blocks once and reuse them across multiple transformations. Rather than manually copying and pasting code, shared code creates a centralized, easily editable resource. Any changes to the shared code block can automatically propagate to all transformations referencing it, significantly enhancing consistency and reducing manual errors.

Main Benefits of Keboola Shared Code

  • Consistency: Ensure that all transformations use the same logic and calculations, eliminating discrepancies and errors.
  • Efficiency: Save time by updating a single shared code block instead of multiple transformations.
  • Maintainability: Simplify your maintenance processes, allowing your team to focus on strategic tasks rather than manual updates.

Shared Code Usage Modes

Keboola supports two distinct modes for leveraging shared code: dynamic and static. Understanding these modes helps users pick the right one for their project needs.

Dynamic Mode (Shared Usage Mode)

In the dynamic mode, transformations reference a shared code block directly. Any change made to the shared code is automatically reflected in all transformations referencing it.

Practical Example: Assume your company uses a shared code block named Sales Metrics across multiple transformations. If your organization needs to update the formula for calculating revenue, you simply update the shared code once. All transformations referencing the Sales Metrics block automatically reflect this updated logic without additional manual intervention.

Static Mode (Inline Usage Mode)

In static mode, the shared code is copied directly into transformations without maintaining a reference. This mode is suitable when you want specific transformations to remain unchanged, even if the original shared code block is updated.

Practical Example: Suppose you have a shared code block named Customer Segmentation. You may use static mode if certain transformations require a stable segmentation logic that shouldn't be automatically updated when changes are made to the original shared code.

Step-by-step Guide to Using Shared Code in Keboola

  1. Creating Shared Code Blocks:
  • Navigate to the transformation section in Keboola.
  • Go to the Shared Code tab to view or manage existing blocks.
  • To create a new block, click the three-dot icon next to your code and select Share Code. Give the shared code a unique, descriptive name.
  1. Using Shared Code in Transformations:
  • Open the transformation editor and click Select Shared Code.
  • Choose the desired shared code block from the available list.
  • Select either Dynamic Mode or Static Mode based on your use case.
  1. Managing Variables:
  • If your shared code uses variables, Keboola prompts you to define or initialize them upon selection.
  • Clicking Initialize automatically sets up the variable for immediate usage.
  1. Updating Shared Code:
  • Edit the shared code block directly under the shared code tab.
  • Once changes are saved, all transformations referencing this block in dynamic mode immediately apply these updates.

Example Scenario: Netflix Titles Transformation

Consider a shared code block named Netflix Titles, which is used to manage various transformations within your project. If the business requires adding a new column, such as Director Name, you can edit the shared code accordingly. Once you save this edit, all transformations referencing the Netflix Titles shared code block instantly receive the new column without manual intervention.

Deleting Shared Code: Precautions

Although shared code simplifies management, caution is necessary when deleting blocks. Removing a shared code block entirely can cause dependent transformations to fail. Errors will appear in job logs indicating missing shared code. To avoid disruptions, carefully verify dependencies before deleting any shared code block.

Best Practices for Using Shared Code

  • Clear Naming Conventions: Use intuitive names for shared code blocks to ensure easy identification and usage.
  • Documentation: Clearly document shared code blocks, variables, and their intended purpose within your organization.
  • Regular Maintenance: Conduct periodic reviews of shared code to ensure it remains relevant, performs optimally, and aligns with business objectives.

Why Choose Keboola for Shared Code?

Keboola's shared code feature simplifies the complexity of managing multiple transformations. It streamlines your data workflows, increases operational efficiency, and reduces human error. With Keboola, your organization can harness the full potential of your data by ensuring consistency and accuracy across all transformations.

Conclusion

Keboola shared code is a powerful, effective tool designed to simplify complex data transformations. By leveraging its dynamic and static modes, you streamline your processes, reduce manual errors, and maintain consistency across multiple transformations. Embrace Keboola's shared code and transform your data management techniques today.

Category:
No items found.

Watch Related Video

Testimonials

No items found.
Unlock the value of your data