Question

How can I extract User Name from FME Database Connections?

  • 2 February 2023
  • 4 replies
  • 22 views

Hello,

 

I am trying to collect and maintain some metadata for FME Workbench, which includes the database connections attributes that each of our workbenches (.fmw files) use. We are currently using FME Desktop 2021.2 on Windows. So far, I have extracted the Database Connection information from the fme_connections.data file using a SQLite transformer. However, many of the values including User_Name are encrypted (fme_enc2).

 

I realize I am stepping into the realm of security and cryptography - and also realize that if I gain access to the user names, I will be able to apply the same principles to passwords and other sensitive data in the Database Connections - and absolutely respect the principle of protecting secrets. That said, I am an FME administrator for my organization, and have access to both the fme_publicKey and fme_privateKey files - and am really only interested in the User Names associated with the connections. If there is a better way to collect that information than backing into the fme_connections.data file, I would gladly accept it.

 

Thanks in advance for any assistance.

 

Best,

Douglas


4 replies

Userlevel 1
Badge +12

Hi,

 

First up, for anyone else reading this. If this was FME Server, you can get these details via the api.

 

But for desktop, it’s not quite as simple and to be honest I have not used the below approach to get this information for database connections but I am pretty sure you will be able to get it. I’ve been using it for Oauth connections for a range of purposes for a few years.

 

As you mention the connection file is SQLite but it’s encrypted for the things that matter. But floating around in the back of FME has been a bunch of Python libraries to access details of these connections. In 2022, Safe provided the documentation and you can find it here: https://docs.safe.com/fme/html/fmepython/api/fmewebservices/connection.html

 

Cheers,

Todd

Userlevel 1
Badge +12

Hi,

 

First up, for anyone else reading this. If this was FME Server, you can get these details via the api.

 

But for desktop, it’s not quite as simple and to be honest I have not used the below approach to get this information for database connections but I am pretty sure you will be able to get it. I’ve been using it for Oauth connections for a range of purposes for a few years.

 

As you mention the connection file is SQLite but it’s encrypted for the things that matter. But floating around in the back of FME has been a bunch of Python libraries to access details of these connections. In 2022, Safe provided the documentation and you can find it here: https://docs.safe.com/fme/html/fmepython/api/fmewebservices/connection.html

 

Cheers,

Todd

Hmmm. I said that, but looking at the details for database connections. It doesn't appear to provide username and I thought it would be under Values. But not seeing it.

Hi Todd,

 

Thank you for quickly joining the conversation last week. My colleague and I poked around with Python as you suggested, but also didn't see anything through getNameValues(). That said, I noticed that it was (dict) type and not a (str) - and it made me wonder if we were invoking it correctly. Also, my colleague was going to work with it on FME Desktop 2022.2 this week to determine if updates had been made in the newer version.

 

We will continue to explore with Python, and let you know if we come up with results. Thanks again for jumping in!

 

Best,

Douglas

Userlevel 1
Badge +12

Hi Todd,

 

Thank you for quickly joining the conversation last week. My colleague and I poked around with Python as you suggested, but also didn't see anything through getNameValues(). That said, I noticed that it was (dict) type and not a (str) - and it made me wonder if we were invoking it correctly. Also, my colleague was going to work with it on FME Desktop 2022.2 this week to determine if updates had been made in the newer version.

 

We will continue to explore with Python, and let you know if we come up with results. Thanks again for jumping in!

 

Best,

Douglas

Yeah, I thought exactly the same thing.

I tested it out with a new connection database last friday and got exactly the same result.

 

The getNameValues returns me {} every time and getId returns me nothing. The others seem to work for me. I actually realised that the webservices library is a subset of another library, so I went looking around that as its bigger, but no luck in that space either.

 

The capability must be there, so whether safe need to make an addition to the class or whether something needs to be fixed up with getNameValues, I am not sure.

Reply