Batch Input with Python-Ldap

Christian Klinger cklinger at novareto.de
Tue Oct 12 16:27:22 CEST 2004


Hello List

I have a question about adding a large numbers of users to ldap with 
python_ldap!
I think the problem is the second part of the script. I put every member 
in the group ENMS!
If I run the script without part two it runs 5 Minuts with it runs much 
longer.

Is this the right way to make an batch import?
Do you have any tips to make it faster?
I test it with 50.000 User but in production there should be 500.000 - 
Is this a problem?

thx Christian


----snip----
for x in range(50000)
    cn=x+basedn
    try:
       l.add_s(dn,[("objectclass",        ["person",]),
                        ("sn",                [cn]),
                        ("cn",                [cn]),
                        ("userpassword",      [pw]),
                       ])
    except ldap.LDAPError, e1:
        err = "DN: %s,  FEHLER: %s, BESCHREIBUNG: %s \n" 
%(dn,e1[0]['desc'],e1[0]['info'])

    try:
        gdn = "cn=ENMS,%s" %(str(orgu))
        l.modify_s(gdn,
                      [(ldap.MOD_ADD,'uniqueMember',dn)]
                  )
    except ldap.LDAPError, e1:
        err = "DN: %s,  FEHLER: %s, BESCHREIBUNG: %s \n" 
%(dn,e1[0]['desc'],e1[0]['info'])

----snip----





More information about the python-ldap mailing list