Skip to content

Commit

Permalink
[jk] Bugfixes - table render / rename destination block (#4797)
Browse files Browse the repository at this point in the history
* [jk] Prevent table render error

* [jk] Fix integration pipeline data exporter rename error

* [jk] Include block pipelines in integration destination block
  • Loading branch information
johnson-mage committed Mar 20, 2024
1 parent c34bbf5 commit cd45092
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 4 additions & 0 deletions mage_ai/data_preparation/models/block/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2497,6 +2497,7 @@ def to_dict_base(
def to_dict(
self,
include_block_catalog: bool = False,
include_block_pipelines: bool = False,
include_callback_blocks: bool = False,
include_content: bool = False,
include_outputs: bool = False,
Expand All @@ -2515,6 +2516,9 @@ def to_dict(
if include_block_catalog and self.is_data_integration() and self.pipeline:
data['catalog'] = self.get_catalog_from_file()

if include_block_pipelines:
data['pipelines'] = self.get_pipelines_from_cache()

if include_outputs:
include_outputs_use = include_outputs
if self.is_using_spark() and self.compute_management_enabled():
Expand Down
20 changes: 12 additions & 8 deletions mage_ai/data_preparation/models/block/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,10 @@ class SourceBlock(IntegrationBlock):
class DestinationBlock(IntegrationBlock):
def to_dict(
self,
include_content=False,
include_outputs=False,
sample_count=None,
include_content: bool = False,
include_outputs: bool = False,
include_block_pipelines: bool = False,
sample_count: int = None,
check_if_file_exists: bool = False,
destination_table: str = None,
state_stream: str = None,
Expand All @@ -444,6 +445,7 @@ def to_dict(
super().to_dict(
include_content=include_content,
include_outputs=include_outputs,
include_block_pipelines=include_block_pipelines,
sample_count=sample_count,
check_if_file_exists=check_if_file_exists,
),
Expand All @@ -452,9 +454,10 @@ def to_dict(

async def to_dict_async(
self,
include_content=False,
include_outputs=False,
sample_count=None,
include_content: bool = False,
include_outputs: bool = False,
include_block_pipelines: bool = False,
sample_count: int = None,
check_if_file_exists: bool = False,
destination_table: str = None,
state_stream: str = None,
Expand All @@ -463,13 +466,14 @@ async def to_dict_async(
return self.to_dict(
include_content=include_content,
include_outputs=include_outputs,
include_block_pipelines=include_block_pipelines,
sample_count=sample_count,
check_if_file_exists=check_if_file_exists,
destination_table=destination_table,
state_stream=state_stream,
)

def update(self, data, update_state=False):
def update(self, data, update_state=False, **kwargs):
if update_state:
from mage_ai.data_preparation.models.pipelines.integration_pipeline import (
IntegrationPipeline,
Expand All @@ -493,7 +497,7 @@ def update(self, data, update_state=False):
bookmark_values=bookmark_values
)

return super().update(data)
return super().update(data, **kwargs)

def output_variables(self, execution_partition: str = None) -> List[str]:
return []
Expand Down
4 changes: 2 additions & 2 deletions mage_ai/frontend/components/CodeBlockV2/Output/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function CodeBlockOutput({
width,
}) => (
<DataTable
columns={data?.columns}
columns={data?.columns || []}
disableScrolling={!selected}
index={data?.index}
key={`data-table-${data?.index}`}
Expand All @@ -284,7 +284,7 @@ function CodeBlockOutput({
noBorderLeft
noBorderRight
noBorderTop={!data?.borderTop}
rows={data?.rows}
rows={data?.rows || []}
width={columnWidth}
/>
),
Expand Down

0 comments on commit cd45092

Please sign in to comment.