AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createAction, Property } from '@activepieces/pieces-framework';
import {
bigQueryAuth,
BigQueryAuthValue,
getAccessToken,
runDmlQuery,
projectIdProp,
datasetIdProp,
tableIdProp,
} from '../common';
export const updateRowsAction = createAction({
auth: bigQueryAuth,
name: 'update_rows',
classification: 'WRITE',
displayName: 'Update Row(s)',
description:
'Updates one or more existing rows in a BigQuery table using SQL SET and WHERE expressions.',
audience: 'both',
aiMetadata: {
description:
'Updates rows in a BigQuery table by running an UPDATE DML statement, applying a comma-separated SET assignment to every row matching a WHERE condition (supply both as raw SQL fragments without the SET/WHERE keywords). Use it to change column values on existing records. Mutates state on each run, so it is not safe to assume idempotency — assignments to fixed literal values repeat harmlessly, but relative expressions (e.g. incrementing a counter) compound on every call.',
idempotent: false,
},
props: {
project_id: projectIdProp,
dataset_id: datasetIdProp,
table_id: tableIdProp,
set_expression: Property.LongText({
displayName: 'SET Expression',
description:
'Comma-separated column assignments. Do not include the SET keyword. Example: `status = "active", updated_at = CURRENT_TIMESTAMP()`',
required: true,
}),
where_clause: Property.LongText({
displayName: 'WHERE Clause',
description:
'SQL condition to match the rows to update. Do not include the WHERE keyword. Example: `id = "abc123"`',
required: true,
}),
location: Property.ShortText({
displayName: 'Location',
description:
'Dataset location (e.g. US, EU). Leave blank to use the default.',
required: false,
}),
},
async run(context) {
const {
project_id,
dataset_id,
table_id,
set_expression,
where_clause,
location,
} = context.propsValue;
const token = await getAccessToken(context.auth as BigQueryAuthValue);
const fullTable = `\`${project_id}.${dataset_id}.${table_id}\``;
const query = `UPDATE ${fullTable} SET ${set_expression} WHERE ${where_clause}`;
const result = await runDmlQuery(
token,
project_id as string,
query,
(location as string) ?? undefined
);
return {
success: true,
rows_updated: result.updatedRowCount,
job_id: result.jobId,
};
},
});