Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion components/azure_sql/actions/execute-query/execute-query.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Execute Query",
description: "Executes a SQL query and returns the results. [See the documentation](https://learn.microsoft.com/en-us/sql/t-sql/queries/select-transact-sql?view=azuresqldb-current)",
type: "action",
version: "0.0.5",
version: "0.0.6",
props: {
app,
query: {
Expand All @@ -20,18 +20,26 @@ export default {
description: "The inputs to the query. These will be available as @input_parameter in the query. For example, if you provide an input named 'id', you can use @id in the query.",
optional: true,
},
requestTimeout: {
propDefinition: [
app,
"requestTimeout",
],
},
},
run({ $ }) {
const {
app,
inputs,
query,
requestTimeout,
} = this;

return app.executeQuery({
$,
query,
inputs,
requestTimeout,
summary: () => "Successfully executed query.",
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@ export default {
name: "Execute SQL Query",
description: "Execute a custom SQL query. See [our docs](https://pipedream.com/docs/databases/working-with-sql) to learn more about working with SQL in Pipedream.",
type: "action",
version: "0.0.4",
version: "0.0.5",
props: {
app,
// eslint-disable-next-line pipedream/props-description
sql: {
type: "sql",
auth: {
app: "app",
},
label: "SQL Query",
},
requestTimeout: {
propDefinition: [
app,
"requestTimeout",
],
},
},
async run({ $ }) {
const args = this.app.executeQueryAdapter(this.sql);
args.requestTimeout = this.requestTimeout;
const response = await this.app.executeQuery(args);
$.export("$summary", "Successfully executed query.");
return response;
Expand Down
10 changes: 9 additions & 1 deletion components/azure_sql/actions/insert-row/insert-row.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "azure_sql-insert-row",
name: "Insert Row",
description: "Inserts a new row in a table. [See the documentation](https://learn.microsoft.com/en-us/sql/t-sql/statements/insert-transact-sql?view=azuresqldb-current)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
app,
Expand All @@ -16,6 +16,12 @@ export default {
],
reloadProps: true,
},
requestTimeout: {
propDefinition: [
app,
"requestTimeout",
],
},
},
async additionalProps() {
const {
Expand All @@ -41,13 +47,15 @@ export default {
const {
app,
table,
requestTimeout,
...inputs
} = this;

return app.insertRow({
$,
table,
inputs,
requestTimeout,
summary: () => "Successfully inserted row.",
});
},
Expand Down
21 changes: 17 additions & 4 deletions components/azure_sql/azure_sql.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ export default {
return recordset.map(({ COLUMN_NAME: columnName }) => columnName);
},
},
requestTimeout: {
type: "integer",
label: "Request Timeout",
description: "The timeout for query execution in seconds. Default is 60 seconds if not specified.",
optional: true,
default: 60,
},
},
methods: {
...sqlProxy.methods,
Expand All @@ -37,7 +44,7 @@ export default {
},
getConfig() {
const {
host, username, password, port, database,
host, username, password, port, database, requestTimeout,
} = this.$auth;
return {
user: username,
Expand All @@ -51,7 +58,7 @@ export default {
options: {
encrypt: true,
port: Number(port),
requestTimeout: 60000,
requestTimeout: (requestTimeout || 60) * 1000, // Convert to milliseconds
},
};
},
Expand Down Expand Up @@ -148,10 +155,16 @@ export default {
},
async executeQuery(preparedStatement = {}) {
let connection;
const { query } = preparedStatement;
const {
query, requestTimeout,
} = preparedStatement;
const inputs = preparedStatement?.inputs || {};
try {
connection = await sql.connect(this.getClientConfiguration());
const config = this.getConfig();
if (requestTimeout) {
config.options.requestTimeout = requestTimeout * 1000; // Convert to milliseconds
}
connection = await sql.connect(config);
const input =
Object.entries(inputs)
.reduce((req, inputArgs) =>
Expand Down
2 changes: 1 addition & 1 deletion components/azure_sql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/azure_sql",
"version": "0.1.4",
"version": "0.1.5",
"description": "Pipedream Microsoft Azure SQL Database Components",
"main": "azure_sql.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/azure_sql/sources/new-column/new-column.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Column",
description: "Triggers when a new column is added to a table.",
type: "source",
version: "0.0.5",
version: "0.0.6",
dedupe: "unique",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New or Updated Row",
description: "Triggers when a new row is added or an existing row is updated.",
type: "source",
version: "0.0.5",
version: "0.0.6",
dedupe: "unique",
props: {
...common.props,
Expand Down
Loading