[Zope] Mysql-Connection in Python-Script

Chris Muldrow muldrow@mac.com
Wed, 18 Dec 2002 14:37:26 -0500


On 12/18/02 2:25 PM, "AM" <list_subscriber@neurobs.com> wrote:

> import MySQLdb, _mysql
> db_con = MySQLdb.connect (host = Self.server,
>                              port = Self.port,
>                              user = Self.user,
>                              passwd = Self.password,
>                              db = Self.db_name)
> 
> Unfortunately this is what I do in a python product. I dont know if
> PyScripts will allow you to import MySQLdb modules. You could of course
> always got he external scripts way and return the connection object ot
> the calling script.
> 
> hth
> AM
> 
> 
> Lukas Pitschl wrote:
> 
>> I would like to use a Mysql-Connection in a Zope-Python-Script.
>> Could someone explain how that works?
>> 
>> I have to import some CSV-data into a database
>> 
>> thanks in advance
>> 
>> lukas
>>  
>> 
If memory serves correctly, PythonScripts won't let you do those imports. I
think you're stuck with calling ZSQL Methods in your PythonScript or using
an external method to make the DB connection.