Source
yaml
id: surreal-db
namespace: company.team
tasks:
- id: article
type: io.kestra.plugin.surrealdb.Query
query: >
CREATE article SET
created_at = time::now(),
author = author:john,
title = 'Lorem ipsum dolor',
text = 'Donec eleifend, nunc vitae commodo accumsan, mauris est fringilla.',
account = (SELECT VALUE id FROM account WHERE name = 'ACME Inc' LIMIT 1)[0]
;
- id: account
type: io.kestra.plugin.surrealdb.Query
query: |
CREATE account SET
name = 'ACME Inc',
created_at = time::now()
;
- id: query
type: io.kestra.plugin.surrealdb.Query
query: SELECT * FROM article, account;
fetchType: STORE
- id: query_condition
type: io.kestra.plugin.surrealdb.Query
query: SELECT * FROM article WHERE author.age < 30 FETCH author, account;
fetchType: STORE
pluginDefaults:
- type: io.kestra.plugin.surrealdb.Query
values:
host: localhost
database: test
namespace: test
username: root
password: root
About this blueprint
This flow will query SurrealDB and store the result in Kestra internal storage. The result of the query can be used by other tasks in the same flow using the syntax {{ outputs.query.uri }}
.
To install and run SurrealDB, follow the instructions in the SurrealDB documentation.