473,666 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LDIFDE csv import to SQL - looking for Ideas

This is a tuffie, but I think I'll learn new techniques in SQL.
I wish to put data from MS Active Directory and put it into a table.
Specificly I want user information (first name, last name and so forth)
and the groups that they belong into a SQL table.
LDIFDE is a utility that can create a csv file from an AD server. This
is a sample output:

dn: CN=rob camarda,OU=Corp orate,OU=Geogra phic
Locations,DC=st rayer,DC=edu
changetype: add
objectClass: top
objectClass: person
objectClass: organizationalP erson
objectClass: user
cn: rob camarda
givenName: rob
memberOf: CN=Arlington Admin,OU=Campus Domain Admin,DC=straye r,DC=edu
memberOf:
CN=Arlington,OU =Arlington,OU=R egion2,OU=Geogr aphic
Locations,DC=st rayer,DC=edu
memberOf: CN=RN Report Consumers,OU=Co gnos ReportNet,DC=st rayer,DC=edu
sAMAccountName: rob.camarda

dn: CN=Robert A. Camarda,OU=Tech nologyGroup,DC= strayer,DC=edu
changetype: add
objectClass: top
objectClass: person
objectClass: organizationalP erson
objectClass: user
cn: Robert A. Camarda
givenName: Robert
memberOf: CN=Role Regional Director,OU=Rol es,DC=strayer,D C=edu
memberOf: CN=Role Campus Director,OU=Rol es,DC=strayer,D C=edu
memberOf: CN=TLSAdmin,OU= Talisma-Users,DC=straye r,DC=edu
memberOf: CN=ASPTestRepor ts,OU=Roles,DC= strayer,DC=edu
memberOf: CN=IT Report Authors,OU=Role s,DC=strayer,DC =edu
memberOf: CN=Developers,O U=TechnologyGro up,DC=strayer,D C=edu
memberOf: CN=SQL Backup Admin,OU=Techno logyGroup,DC=st rayer,DC=edu
memberOf: CN=RN Report MetaData Modelers,OU=Cog nos
ReportNet,DC=st rayer,DC=edu
memberOf:
CN=RN Corporate,OU=Co rporate,OU=Regi on2,OU=Geograph ic
Locations,DC=st rayer,DC=
edu
memberOf:
CN=Arlington,OU =Arlington,OU=R egion2,OU=Geogr aphic
Locations,DC=st rayer,DC=edu
memberOf: CN=RN Administrator System,OU=Cogno s
ReportNet,DC=st rayer,DC=edu
memberOf: CN=RN Administrator Server,OU=Cogno s
ReportNet,DC=st rayer,DC=edu
memberOf: CN=RN Report Authors,OU=Cogn os ReportNet,DC=st rayer,DC=edu
memberOf: CN=Backup Operators,CN=Bu iltin,DC=straye r,DC=edu
memberOf: CN=Domain Admins,CN=Users ,DC=strayer,DC= edu
memberOf: CN=Administrato rs,CN=Builtin,D C=strayer,DC=ed u
sAMAccountName: robert.camarda

In this output, each user is separated by a blank line. sAMAccountName
is the user's login ID to ADS. Lines starting with memberOf: shows the
path for each group the user belongs.

My thought is to load the text data into a SQL table with the PK being
the line number. This way the data will stay together. The second
column would be just text, varchar(100).
I'd like to end up with a table something like
USER_ID, GROUP_MEMBERSHI P, GIVENNAME
In the example of robert.camarda, that user belongs to 7 groups, so
there would be 7 records, one for each group. I think once I have this
part, I can build my final table with PK's an all the good-house
keeping of a SQL Table.

Now the part that I have no idea how to solve:
How do I convert the data from unfriendly for databases, to something I
can use?
1. I know I have a new user when I find dn:
2. I know I am done with the user when I get a blank (null) line.
3. I know what I want to populate rows with name and the contents once
I find rows starting with memberOf:
4. It appears there is a max line length that LDIFDE will export, and
starts a new line. So, it will be necessary to join lines.
I would think this is a combo of CURSORS, a do/while loop and other
assorted magic.

If someone can help me get started, I would have something to reseach
or model from. As of now, im staring and a blank page and not sure how
to start. Maybe someone knows of a simular problem that can share the
SQL.
TIA
Rob

Dec 21 '05 #1
1 3740
Hi

Instead you may want to check out:
http://www.rlmueller.net/List%20User%20Groups.htm

John

"rcamarda" <rc******@cable speed.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.com...
This is a tuffie, but I think I'll learn new techniques in SQL.
I wish to put data from MS Active Directory and put it into a table.
Specificly I want user information (first name, last name and so forth)
and the groups that they belong into a SQL table.
LDIFDE is a utility that can create a csv file from an AD server. This
is a sample output:

dn: CN=rob camarda,OU=Corp orate,OU=Geogra phic
Locations,DC=st rayer,DC=edu
changetype: add
objectClass: top
objectClass: person
objectClass: organizationalP erson
objectClass: user
cn: rob camarda
givenName: rob
memberOf: CN=Arlington Admin,OU=Campus Domain Admin,DC=straye r,DC=edu
memberOf:
CN=Arlington,OU =Arlington,OU=R egion2,OU=Geogr aphic
Locations,DC=st rayer,DC=edu
memberOf: CN=RN Report Consumers,OU=Co gnos ReportNet,DC=st rayer,DC=edu
sAMAccountName: rob.camarda

dn: CN=Robert A. Camarda,OU=Tech nologyGroup,DC= strayer,DC=edu
changetype: add
objectClass: top
objectClass: person
objectClass: organizationalP erson
objectClass: user
cn: Robert A. Camarda
givenName: Robert
memberOf: CN=Role Regional Director,OU=Rol es,DC=strayer,D C=edu
memberOf: CN=Role Campus Director,OU=Rol es,DC=strayer,D C=edu
memberOf: CN=TLSAdmin,OU= Talisma-Users,DC=straye r,DC=edu
memberOf: CN=ASPTestRepor ts,OU=Roles,DC= strayer,DC=edu
memberOf: CN=IT Report Authors,OU=Role s,DC=strayer,DC =edu
memberOf: CN=Developers,O U=TechnologyGro up,DC=strayer,D C=edu
memberOf: CN=SQL Backup Admin,OU=Techno logyGroup,DC=st rayer,DC=edu
memberOf: CN=RN Report MetaData Modelers,OU=Cog nos
ReportNet,DC=st rayer,DC=edu
memberOf:
CN=RN Corporate,OU=Co rporate,OU=Regi on2,OU=Geograph ic
Locations,DC=st rayer,DC=
edu
memberOf:
CN=Arlington,OU =Arlington,OU=R egion2,OU=Geogr aphic
Locations,DC=st rayer,DC=edu
memberOf: CN=RN Administrator System,OU=Cogno s
ReportNet,DC=st rayer,DC=edu
memberOf: CN=RN Administrator Server,OU=Cogno s
ReportNet,DC=st rayer,DC=edu
memberOf: CN=RN Report Authors,OU=Cogn os ReportNet,DC=st rayer,DC=edu
memberOf: CN=Backup Operators,CN=Bu iltin,DC=straye r,DC=edu
memberOf: CN=Domain Admins,CN=Users ,DC=strayer,DC= edu
memberOf: CN=Administrato rs,CN=Builtin,D C=strayer,DC=ed u
sAMAccountName: robert.camarda

In this output, each user is separated by a blank line. sAMAccountName
is the user's login ID to ADS. Lines starting with memberOf: shows the
path for each group the user belongs.

My thought is to load the text data into a SQL table with the PK being
the line number. This way the data will stay together. The second
column would be just text, varchar(100).
I'd like to end up with a table something like
USER_ID, GROUP_MEMBERSHI P, GIVENNAME
In the example of robert.camarda, that user belongs to 7 groups, so
there would be 7 records, one for each group. I think once I have this
part, I can build my final table with PK's an all the good-house
keeping of a SQL Table.

Now the part that I have no idea how to solve:
How do I convert the data from unfriendly for databases, to something I
can use?
1. I know I have a new user when I find dn:
2. I know I am done with the user when I get a blank (null) line.
3. I know what I want to populate rows with name and the contents once
I find rows starting with memberOf:
4. It appears there is a max line length that LDIFDE will export, and
starts a new line. So, it will be necessary to join lines.
I would think this is a combo of CURSORS, a do/while loop and other
assorted magic.

If someone can help me get started, I would have something to reseach
or model from. As of now, im staring and a blank page and not sure how
to start. Maybe someone knows of a simular problem that can share the
SQL.
TIA
Rob

Dec 25 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3049
by: Torsten Mohr | last post by:
Hi, is there some description available to overwrite the import hook? By googling i found out so far that i need to overwrite __builtins__.__import__ with something else. Can i also do this with a C function that is provided when using an embedded python interpreter? So my own C program provides this and when linking with python.lib the function is overwritten?
2
2567
by: Jon | last post by:
It appears that (windows) python searches in the current working directory before looking in the local site-packages directory, or that '.' comes first in sys.path? The problem arises when I made the mistake of running a test program from the same directory where I built and installed my package. Python uses the package from the current directory, which misses the pyd files, instead of the site-packages package which has them installed. ...
4
1742
by: Jeremy Sanders | last post by:
Hi - Is it possible to override the import process so that if in my program I do import foo.bar Python will look for bar in a directory which isn't called foo? I want my module/program to be able to be run without being installed in site-packages, so by doing "import foo.bar", it should start looking for bar in the current directory which could be called "foo-0.43".
2
6904
by: Quique | last post by:
Hello, I've got a problem importing a worksheet Excel into a temporary table in access. All the information is imported but the table is not ordered as it is originally in excel. I'm using a VBA code rather simple as the following: Private Sub Import() ... Dim TableName As String
12
11079
by: =?Utf-8?B?am9uaWdy?= | last post by:
I wrote a simple VB.NET application that imports and edits CSV files. Now I’d like to “lock” the raw (pre-import) CSV files so these cannot be opened separately. It is not high-sensitive data, I just don’t want folks to peek in the files. So time-consuming encryption is not necessary, just a simple password-to-open that I can program in my application so it internally opens the imported CSV file would be perfect, but I can’t...
4
1695
by: spohle | last post by:
hi, i have written a small project for myself all in seperate classes and each of the classes lives in a seperate file. now i am looking for an import structure something like import wx, and then have access to all my classes just like wx.Button or wx.BoxSizer etc. as of now i have a __init__.py file in the directory with: from pkgutil import extend_path __path__ = extend_path(__path__, __name__)
2
2075
by: thread | last post by:
Hi All i'm building a database in access and i want to restrict permissions. from the access i can just limit the posiblity to unhide an hidden table and in this way i can preventing the users from looking in un- relevant data my problem is how can i prevent the posiblity to import the data from another mdb file becaouse it is quite simple and visible to extract the information from another mdb file any ideas?
5
7156
Eonasdan
by: Eonasdan | last post by:
Greetings! I hope some can help with out with this. I am trying to write a scripting using bcp to import large amounts of data from a text file that is tab delimited. The problems I have run into is that when bcp does import the from the file, it will only import 8 lines, then stop. Opening the text file reveals that it contains characters like / \ , ' " . and all sorts of messy things. Looking at the table after importing the 8 lines also shows...
3
3974
by: RachH | last post by:
I import tables from one Access 2003 database into another 1x/day (for various reasons, linking tables does not meet the need). The database I am importing from is password protected at the general level so I am asked for a password with each table I import. Is there a way to include the password in the import code? My VBA import code is as follows: DoCmd.TransferDatabase acImport, "Microsoft Access", _ "c:\Pdb.mdb", acTable, "Price",...
0
8360
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8784
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8556
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8642
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1777
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.