Discussion:
Lookup through CSV/TXT files and compare with LDAP attribute
(too old to reply)
r***@gmail.com
2019-11-15 06:26:30 UTC
Permalink
Need help to understand efficient way to compare or match data between files and LDAP.
Suppose I have a file with list data and I want to check if the entry obtained while lookup in LDAP has matching value in file, what is the best way to do this?

Currently I am using a file connector to iterate the file and save the data in a array and later I will check if LDAP attribute has matching value with for loop through the array.
Franzw
2019-11-18 07:05:39 UTC
Permalink
Post by r***@gmail.com
Need help to understand efficient way to compare or match data between files and LDAP.
Suppose I have a file with list data and I want to check if the entry obtained while lookup in LDAP has matching value in file, what is the best way to do this?
Currently I am using a file connector to iterate the file and save the data in a array and later I will check if LDAP attribute has matching value with for loop through the array.
You should be able to do this most efficiently by just iterate through you file and then perform a lookup of the data in the ldap line by line. By default the ldap connector will reuse the ldap connection. If the entry is not found in ldap the lookup will fail - to avoid the assemblyline to halt you need to use one of error hooks.

One caveat is whether you can do do this using one look up - if not you can choose to use a case branching based on the lookup attribute - this can be scripted as well but will require the ldap connector to initialized each time which may be costly (if non-ssl you need not care).

HTH

Regards
Franz Wolfhagen
Eddie Hartman
2019-11-19 08:51:30 UTC
Permalink
Post by Franzw
Post by r***@gmail.com
Need help to understand efficient way to compare or match data between files and LDAP.
Suppose I have a file with list data and I want to check if the entry obtained while lookup in LDAP has matching value in file, what is the best way to do this?
Currently I am using a file connector to iterate the file and save the data in a array and later I will check if LDAP attribute has matching value with for loop through the array.
You should be able to do this most efficiently by just iterate through you file and then perform a lookup of the data in the ldap line by line. By default the ldap connector will reuse the ldap connection. If the entry is not found in ldap the lookup will fail - to avoid the assemblyline to halt you need to use one of error hooks.
One caveat is whether you can do do this using one look up - if not you can choose to use a case branching based on the lookup attribute - this can be scripted as well but will require the ldap connector to initialized each time which may be costly (if non-ssl you need not care).
HTH
Regards
Franz Wolfhagen
This also will depend on what your are trying to solve. If you have a small file, then doing a handful of lookups should do fine. If you file is large and the attributes varied, then you might instead read the file into an in-memory collection (like a HashMap, keyed for example on the $dn or some unique value) and then iterate through the LDAP directory, doing the comparisons as you read.

/Eddie

Loading...