Actions25
- Append Block
- Create Document
- Create Notebook
- Delete Block
- Execute SQL Query
- Export Document Markdown
- Get Block Attributes
- Get Block Kramdown
- Get Child Blocks
- Get Document ID by Path
- Get Document Path by ID
- Insert Block
- List Documents in Notebook
- List Files in Directory
- Move Document
- Prepend Block
- Push Error Message
- Push Message
- Remove Document
- Remove Notebook
- Rename Document
- Rename Notebook
- Render Sprig Template
- Set Block Attributes
- Update Block
Overview
This node integrates with the SiYuan note-taking and knowledge management system via its API, enabling automation of various content and document management tasks. It supports a wide range of operations such as creating notebooks and documents, manipulating blocks of content, querying the underlying database with custom SQL, and managing document metadata.
The Execute SQL Query operation allows users to run arbitrary SQL statements directly against their SiYuan database. This is particularly useful for advanced users who want to fetch, filter, or modify data beyond the standard API capabilities. For example, you could retrieve all blocks containing a specific keyword, aggregate statistics about your notes, or perform batch updates.
Practical scenarios include:
- Extracting customized reports from your SiYuan notes.
- Performing bulk data modifications or cleanups.
- Integrating SiYuan data with other systems by exporting query results.
Properties
| Name | Meaning |
|---|---|
| SQL Statement | The full SQL query to execute on your SiYuan database. Example: SELECT * FROM blocks WHERE content LIKE '%keyword%' |
Output
The output is a JSON array representing the result of the executed SQL query. Each item corresponds to a row returned by the query, structured as key-value pairs where keys are column names.
If the query modifies data (e.g., INSERT, UPDATE), the output will reflect the response from the SiYuan API indicating success or details of the operation.
This node does not output binary data.
Dependencies
- Requires an active connection to a SiYuan instance via its API.
- Needs credentials including the SiYuan API URL and an API token for authentication.
- The node depends on the
SiYuanClientlibrary to communicate with the SiYuan API.
Troubleshooting
- Missing Credentials Error: If the API URL or token is not provided or invalid, the node will throw a "Credentials missing!" error. Ensure that valid credentials are configured in n8n before running the node.
- Unsupported Operation: If an unsupported operation name is used, the node throws an error specifying the unsupported operation.
- SQL Syntax Errors: Since the node executes raw SQL, malformed queries will cause errors returned from the SiYuan API. Verify your SQL syntax carefully.
- Permission Issues: Running certain SQL queries may require appropriate permissions on the SiYuan database. Lack of permissions can lead to authorization errors.
- Empty Results: Queries that do not match any data will return empty arrays; this is expected behavior.