SQL Query
AI-generatedOverview
This node executes a custom SQL query against the SiYuan database. It is useful for advanced users who want to perform direct database queries to retrieve specific data from the SiYuan knowledge base. For example, a user can run a query to fetch the latest 10 blocks or filter blocks based on certain criteria using SQL syntax.
Use Case Examples
- Run a SQL query to select all blocks with a limit of 10: SELECT * FROM blocks LIMIT 10
- Query blocks with a specific attribute or condition using SQL statements
Properties
| Name | Meaning |
|---|---|
| SQL Statement | The SQL query to run on the SiYuan database. This is a required string input where users can write their custom SQL commands. |
Output
JSON
success- Indicates if the SQL query was executed successfully.data- The result set returned from the SQL query, typically an array of blocks or records matching the query.
Dependencies
- Requires an API key credential for SiYuan API access, including apiUrl and apiToken for authentication.
Troubleshooting
- Common issues include malformed SQL queries causing errors from the database. Ensure the SQL syntax is correct and compatible with the SiYuan database schema.
- API authentication errors if the provided credentials (apiUrl or apiToken) are invalid or expired. Verify the credentials are correct and have necessary permissions.
- If the node throws an error, check if the 'continueOnFail' option is enabled to handle errors gracefully and continue processing other items.
Links
- SiYuan API Documentation - Official documentation for SiYuan API including database query capabilities.