Two methods:
conn:execute
To write to a database you can use conn:execute{}
. This allows you to execute any ad hoc SQL statement on a database, including UPDATE and INSERT statements. Can also call Stored procedures (link)
By default, SQL statements specified in calls to conn:execute{}
are not executed while you are editing the script. They are only executed when the channel is being run. This behavior can be overridden by setting the live parameter to true, in which case the statements are executed every time the script is executed in the editor. Be cautious about using live=true
since the script is executed many times to get the annotation and auto-completion data (which can cause many INSERTs and UPDATEs) .
db.tables and conn:merge
how to choose method to use
show examples of both
may need to be split into multiple pages