Skip to content

Commit

Permalink
improve model
Browse files Browse the repository at this point in the history
  • Loading branch information
vinicvaz committed Jun 21, 2024
1 parent 53deb5a commit 4a2b33d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pieces/GetGoogleSheetPiece/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ class InputModel(BaseModel):


class OutputModel(BaseModel):
output_data: dict = Field(
description="Sleep piece executed"
output_data: list = Field(
title="Output Data.",
description="List of records from the Google Sheet."
)

class SecretsModel(BaseModel):
service_account_data: str = Field(
title="Service Account",
description="Service account JSON data for Google Sheets API",
description="Service account JSON data for Google Sheets API. Paste it as a string.",
)
5 changes: 4 additions & 1 deletion pieces/GetGoogleSheetPiece/piece.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ def piece_function(self, input_data: InputModel, secrets_data: SecretsModel):
records = worksheet.get_all_records()
df = pd.DataFrame.from_records(records)

return OutputModel(output_data=df.to_json())
print('DF', df.to_dict())
print('df', df.to_dict(orient='records'))

return OutputModel(output_data=df.to_dict(orient='records'))

0 comments on commit 4a2b33d

Please sign in to comment.