9 Replies Latest reply on Dec 7, 2016 8:11 AM by dariuszk32546812

    Accessing the Lightroom Catalog directly

    plunkettphoto

      I want to open the LR catalog as readonly in an external RealBasic program and access a photo's metadata.  I understand that the LR catalog is a mysql file.  Is there any documentation anywhere about doing this?

       

      thanks

      bill plunkett

        • 1. Re: Accessing the Lightroom Catalog directly
          john beardsworth Adobe Community Professional & MVP

          No. In fact it's SQLite3 and there's an open source ODBC driver/

          • 2. Re: Accessing the Lightroom Catalog directly
            plunkettphoto Level 1

            Thanks John,  that gives me a starting point....

             

            b

            • 3. Re: Accessing the Lightroom Catalog directly
              plunkettphoto Level 1

              Okay, I can open the catalog. but where are the tables and columns defined?  I can't even seem to locate the photo's filename...

               

              thanks

              b

              • 4. Re: Accessing the Lightroom Catalog directly
                john beardsworth Adobe Community Professional & MVP

                What are you actually trying to achieve? Have you not tried using the plug-in architecture?

                • 5. Re: Accessing the Lightroom Catalog directly
                  plunkettphoto Level 1

                  I want to write my own database front end for my image management system that will track stock sales, agency submissions, and prints sold.  I don't want to re-enter metadata information such as captions, keywords, ratings etc.

                   

                  My original plan was to use the LR catalog as a readonly extension to my own database to access the above mentioned info.  I use a serial number as a GUID for my images and for in-house images it is also the file name.  For images submitted to my stock agent, I have to rename the files to meet other requirements.

                   

                  I could use the plug-in structure if I could sequentially read each image in the catalog and write out another table in another database.  But I understand that sequentially reading through all the images is not possible in a plug-in.

                   

                  Just as a little background, I am now a professional full-time photographer but I spent my "Prior Life" as a programmer and database administrator but only on large mainframes - no Macs or PCs.  I am feeling my way around writing apps using RealBasic.  I've had the SQL experience on an IBM mainframe using VM and DOS/VSE with SQL/DS - some time ago though....

                   

                  Thanks so much for your help.  Forums are something we never had in the mainframe world.

                   

                  bill

                  • 6. Re: Accessing the Lightroom Catalog directly
                    plunkettphoto Level 1

                    Forgot to add - I found the LR table with the filename in it.  I could use this table to select where the filename is the GUID and then access Adobe's God Awful Global_ID field which is apparently the key to the information in the other tables....

                     

                    b

                    • 7. Re: Accessing the Lightroom Catalog directly
                      john beardsworth Adobe Community Professional & MVP

                      OK, then with SQL experience you should be able to find your way around. I've done similar real database work in the past and an external database was the first approach I took - using Access as my front end - and one advantage was being able to add my own tables and implement far prettier output than one can get with the Lua.

                       

                      One little point is the plug-in architecture does allow you to sequentially read records in the database, and you could make it execute shell commands or output xml. But it wouldn't allow you to write to what SQL would call a table (confusingly the SDK's Lua can write to what it calls "tables" but these are only what everyone else calls "arrays").

                       

                      I've tended to move away from that external SQL approach though and - through gritted teeth - have learnt Lua. I want to keep as much data as possible with the catalogue and to facilitate a multi-machine workflow. Imagine I have a Mac laptop and my main PC is a desktop and I want to enter base level data such as a Getty reference (or even image sales). Do it via a plug-in, installed on both machines, and I'm entering the reference value in a custom field and it travels with the images when I use Export/Import as Catalog to move work between machines, so I could update the base data wherever I may need. Record that reference directly in an external SQL and I'd have to wait until I'm near the main computer, or would have to develop some mechanism for moving the data. So I feel it's best to keep the external database as a report writer, maybe with some global data stored in it, but keeping the base level data in the catalogue. Do you see what I mean?

                       

                      John

                      • 8. Re: Accessing the Lightroom Catalog directly
                        plunkettphoto Level 1

                        Not only do I see what you mean, we seem to be doing about the same thing.  I'm wanting to add functionality to what I can do with the catalog information to provide management reports/information.  My first idea was to just use the LR catalog as an additional SQL table in a second database within my application.  This seems to be getting to be more and more problematic. If I can write a plug in to LR that just reads through the catalog and writes out a file of some kind that I can then use to build a table in my app's database I can get to where I want to be, if not the most elegant solution, it is at least a solution.

                         

                        Seems like my next step is to learn something about lua and the plug-in architecture.

                         

                        Thanks a lot for your help, you are clearing some things up.

                         

                        b