Writing my program to access RT: directly query the DBMS?

I’m trying to write programs which access the RT database (such as a
daily program to mail staff members “Hi, this is the RT reminder, here
are the most important tickets you own for today:”)

I can easily write a Python script which will issue SQL requests such
as:

SELECT Tickets.id,Tickets.subject,Tickets.created,Tickets.priority
FROM Tickets,Users WHERE Users.Name = ‘USERNAME’ AND Users.id=Tickets.owner
AND (status=‘open’ or status=‘new’)
ORDER BY priority DESC, Tickets.created ASC LIMIT 10;

But I wonder if it is the better way and if I should not instead, use
RT packages (to get the DBMS config, get DBMS independance, etc). But
I do not find, in URL:http://fsck.com/rtfm/article.html?id=123 a way
to do so (I do not want to write a Scrip, my program will run outside
of RT).

Stephane Bortzmeyer bortzmeyer@netaktiv.com writes:

I’m trying to write programs which access the RT database (such as a
daily program to mail staff members “Hi, this is the RT reminder, here
are the most important tickets you own for today:”)

I can easily write a Python script which will issue SQL requests such
as:

SELECT Tickets.id,Tickets.subject,Tickets.created,Tickets.priority
FROM Tickets,Users WHERE Users.Name = ‘USERNAME’ AND Users.id=Tickets.owner
AND (status=‘open’ or status=‘new’)
ORDER BY priority DESC, Tickets.created ASC LIMIT 10;

But I wonder if it is the better way and if I should not instead, use
RT packages (to get the DBMS config, get DBMS independance, etc). But
I do not find, in URL:http://fsck.com/rtfm/article.html?id=123 a way
to do so (I do not want to write a Scrip, my program will run outside
of RT).

I’ve got a perl script that deos stuff like that. I think you’ll find
the man pages for the different modules good reading, plus the source
code for bin/rt and the various modules also.

Happy hacking
/Ian D
ian@assv.net