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

[jk] Bugfixes - table render / rename destination block #4797

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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