Examples of TicketSQL scripts

Hello all,

As I understand it, there ought to be a way for one to write a script that
would connect to an RT installation, pass some queries in TicketSQL to it
and get the results back. Is that accurate? If so, do code
samples/instructions exist?