Aperture Database - Can it be read dynamically or exported to XML?

In my quest to arrive at my ultimate Aperture -> Web experience, I'm looking at ways to export or read the data in the Aperture database. From what I've read in the forums it some mention that it uses a SQL based format.

As a SQL (in Microsoft terms) user, this is exciting as it opens the doors to many options in my own web application.

Problem is, I don't have a clue where to start looking for said database, or how to connect to it from a mac. Can anyone advise?

Much appreciated,

Ted

Powermac G5, Mac OS X (10.4.8)

Posted on Jan 7, 2007 1:20 AM

Reply
11 replies

Jan 7, 2007 1:41 AM in response to Ted Nugent

Ted

Not dug into Aperture's database myself, but a quick Google revealed it may be a SQLite3 database:

http://www.majid.info/mylos/stories/2005/12/01/apertureInternals.html

Assuming that's so, and assuming Apple haven't password-protected the database, there's a cross platform database browser at http://sourceforge.net/projects/sqlitebrowser which lets you examine the database structure, and there's an ODBC driver at http://www.ch-werner.de/sqliteodbc/ which you could use to connect to the database from something like Filemaker.

John

MacBook Pro Mac OS X (10.4.8) PC user with a Mac too

Jan 7, 2007 9:58 AM in response to Ted Nugent

yes, probably parts of the database are based on SQLite, but even if you could read it, then what? its probably going to tell you all the locations of the image files and their organization within projects/folders/albums.

but at the end of the day, i'm not sure what you would do with that information since you still need Aperture the application to read the originals, apply your adjustments, and output them in sizes suitable for web viewing. especially if you're shooting RAW.

since Aperture's already got some powerful built-in organizational tools, i'm not sure what attaching another database to it would bring? it would be interesting to hear what you were thinking though.

scott

PowerMac G5 2.5GHz Mac OS X (10.4.8) MacBook Pro 2.0GHz

Jan 7, 2007 1:07 PM in response to scott nichol

Really it's something for the original poster, but his question's not exactly out of deep space. I've done q a few integrations of cataloguing apps with web sites, for instance scripting the FTP and SQL to update the online databases, getting pricing info from another database rather than abusing some IPTC fields in the app etc.

Although Fazal Majid's site looked well-researched, since then I've dug into the libary and haven't found much SQLite. Not sure I found any. Lots of folders and xml files, but nothing like Lightroom's central database which could be used as I envisaged. So I suspect the original poster would be into a lot of scripting rather than doing a quick SQL job.

Anyway, original poster - it's your thread.

John

Jan 7, 2007 6:53 PM in response to johnbeardy

Thanks for the pointers on these John, they were really helpful. After some digging, I've been able to read the Aperture database with success, although it'll take me some time to get the schema understood.

I do find it odd (now that I've been able to see some of teh innards) that although Aperture is fairly open in terms of what you can do to extend it, but there is NO documention or online insight into the structures that Aperture works out.

I'm left to reverse-engineer whatever I can see in order to simplify my own workflow - I'd certainly prefer this more than a locked down structure, but it would be great to see the AP developers provide some hints as to how us developers can extend their great product.

Thanks again for the help - 'tis appreciated!

Ted

Jan 7, 2007 6:58 PM in response to scott nichol

Scott, I don't actually intend to attach another database, I just want to expose my own view on the data in order to use it more effectively in my own application.

My troubles lie largely in that I am a new Mac OSX convert, so I'm still learning how to take advantage of the different way at looking at file systems and services that a OSX box offers vs a Windows environment. For example, the "Show Package Contents" was totally from left-field from what I could find. 🙂

Aperture does have some of the most powerful tools, and I've already integrated it into my workflow - as it was either Lightroom or Aperture. They're fairly comparible, but both fall short in exposing the structures they allow a user to use to organize their shots. If anyone here knows of a place where I can work with other Aperture extenders, that would be extremely helpful. My google searches so far have been fruitless. 😟

Much appreciated for the insight!

Cheers,

Ted

Jan 8, 2007 7:10 AM in response to johnbeardy

John,

Inside the Aperture library package (accessed through "show package contents") there is a file somewhere called Library.apdb

I option-dragged this file to my desktop, creating a copy which is accessible with Sqlite Database Browser mentioned earlier.

This way you can browse all the tables and data as you would with any SQL database.

Hope this helped...

Peter

Jan 9, 2007 3:35 AM in response to johnbeardy

Hi John - I'm not yet entirely sure what I'm doing, but so far I've been able to:

- make a duplicate of just the SQL data
- open the copy (to preserve my real data)
- selected rows from all tables (data can be modified, but I'm not sure yet on creating human-readible views of the Aperture data.

To get the duplicate, I had to first navigate to my aperture library. Opening my terminal, I executed a CD command to:

cd "/Aperture Photo Libraries/Aperture Library.aplibrary/Aperture.aplib" [enter]

Here you'll find the SQL database, called "Library.apdb". Copy this to a safe location so you can muck about with it. (I used my home directory) using:

copy Library.aplibrary ~/testdatabase.apdb [enter]

Change to your home directory by:

cd ~ [enter]

Still from the terminal window, you can open the database with:

sqlite3 testdatabase.apdb [enter]

From here it seems to be fairly standard SQL based commands to manipulate the data, but I did find it a bit quirky. With poor documentation online, the important thing is to be sure to end all SELECT, INSERT or UPDATE commands with a semi-colon ; . Until I got this, I was in terminal ****. 🙂

You can get a list of all the tables in the database by using:

.tables [enter] once inside the SqlLite3 command prompt. If you use

SELECT * FROM zrkkeyword; - you should see a selection of all the keywords in your library. I am not yet aware of the database schema or rules as it applies to ensuring valid Aperture data, I hope to get that identified over the next week or two.

Hope it helps - if you find anything, lemme know. 🙂

Cheers,

ted

Jan 10, 2007 10:41 AM in response to Ted Nugent

there are existing analyses of the Aperture database structure already out there, which you should at least read for a starting point.

e.g. (after a quick google to refind them)

http://www.majid.info/mylos/stories/2005/12/01/apertureInternals.html
(includes a relation diagram)

Also Adam Tow's analysis of Aperture database operations:

http://www.tow.com/2006/11/08/theory-on-aperture-slowdown/
(informative comments on that one, too)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Aperture Database - Can it be read dynamically or exported to XML?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.