Attachment extraction from DB

Hi All,

Has anyone ever had to extract files (docs,pdf’s) out of the RT DB
onto files on the filesystem? If so would you mind sharing how you
went about it?

Regards

Ronald

Excerpts from ronald higgins’s message of Mon Jul 02 03:41:18 -0400 2012:

Hi All,

Has anyone ever had to extract files (docs,pdf’s) out of the RT DB
onto files on the filesystem? If so would you mind sharing how you
went about it?

To be terribly snarky, I went to the attachment I wanted in RT’s web UI,
right-clicked on the link, and selected ‘Save link as’.

Look at lib/RT/Attachment.pm and the places it’s used for how RT does
it, using the Perl API. And that’s mostly just taking the information
that running ‘describe Attachments’ in your favorite SQL DB will tell
you exists in the database and putting it in the right places.

Best,

  • KevinR

Hi,

API’s exist for a reason. I am curious if your really mean direct DB access or just a way to extract an attachment.

I would start with
RT::Client::REST::Attachment - this object represents an attachment. - metacpan.org.

RobertOn Jul 2, 2012, at 3:41 AM, ronald higgins ronald.higgins@gmail.com wrote:

Hi All,

Has anyone ever had to extract files (docs,pdf’s) out of the RT DB
onto files on the filesystem? If so would you mind sharing how you
went about it?

Regards

Ronald

right clicking through 1.2 million tickets might cause some finger strain :slight_smile:

indeed, i meant a method to dump directly from mySQL to disk. i shall look
into how to interact via the api then.

thanksOn 2 Jul 2012 23:58, “Kevin Riggle” kevinr@bestpractical.com wrote:

Excerpts from ronald higgins’s message of Mon Jul 02 03:41:18 -0400 2012:

Hi All,

Has anyone ever had to extract files (docs,pdf’s) out of the RT DB
onto files on the filesystem? If so would you mind sharing how you
went about it?

To be terribly snarky, I went to the attachment I wanted in RT’s web UI,
right-clicked on the link, and selected ‘Save link as’.

Look at lib/RT/Attachment.pm and the places it’s used for how RT does
it, using the Perl API. And that’s mostly just taking the information
that running ‘describe Attachments’ in your favorite SQL DB will tell
you exists in the database and putting it in the right places.

Best,

  • KevinR

right clicking through 1.2 million tickets might cause some finger strain :slight_smile:

indeed, i meant a method to dump directly from mySQL to disk. i shall look
into how to interact via the api then.

For mysql it’s pretty much simple. Just dump whatever in Content column. I would
use Perl API rather than REST for this operation, but it’s for you to decide.

thanks

Excerpts from ronald higgins’s message of Mon Jul 02 03:41:18 -0400 2012:

Hi All,

Has anyone ever had to extract files (docs,pdf’s) out of the RT DB
onto files on the filesystem? If so would you mind sharing how you
went about it?

To be terribly snarky, I went to the attachment I wanted in RT’s web UI,
right-clicked on the link, and selected ‘Save link as’.

Look at lib/RT/Attachment.pm and the places it’s used for how RT does
it, using the Perl API. And that’s mostly just taking the information
that running ‘describe Attachments’ in your favorite SQL DB will tell
you exists in the database and putting it in the right places.

Best,

  • KevinR

Best regards, Ruslan.