[IronPython] MySQL and Iron Python

Harry Percival harry.percival at gmail.com
Thu Jul 22 10:24:47 CEST 2010


Hi Ian,

I've been having fun getting sqlalchemy ( http://www.sqlalchemy.org/ )
to work on IronPython for the last few months.

If you want a richer API for querying databases, it's pretty good -
although it's primarily designed as an ORM, so it's philosophy is more
about definining your OO classes first and then choosing some of the
to persist in a database, rather than reading from existing databases.
 Also, sqlalchemy is not supported on IPY and there are some bugs if
you start to do anything really complicated.

However, the core functionality works fine, and it will certainly give
you field-name based access and, generally, a pleasant querying API.
Ping me back if you need some help getting it to run, but in a
nutshell:
1: download sqlalchemy
2: open download folder in cmd.exe
3: run "ipy setup.py install --no-compile"
4: sqlalchemy is now installed inside c:\program
files\ironpython\lib\site-packages.
5; check it works: ipy, >>>import sqlalchemy
6: read the sqla manual!

rgds,
harry
On Tue, Jul 20, 2010 at 10:47 PM, Vernon Cole <vernondcole at gmail.com> wrote:
> Field name access is the next development step. The API calls for position
> (field number) access. Field name access is an extension. I personally think
> that it is the obvious thing to do, but the movers and shakers of the
> database API don't see it the same way.  My big goal is to add that feature.
> I implemented name access for (input) parameters in the last revision.
> (paramstyle='named').  So for today, you must use column position to read
> the data.
> --
> Vernon
>
> On Tue, Jul 20, 2010 at 1:12 PM, Ian Hobson <ian at ianhobson.co.uk> wrote:
>>
>> Thanks Vernon,
>>
>> With your help I now have some data!
>>
>> Now to find out if I can access it by field name and not just position.
>>
>> Thanks again
>>
>> Ian
>>
>> On 20/07/2010 19:32, Vernon Cole wrote:
>>
>> You need to supply a "Driver" for each dialect of SQL you use. The
>> Microsoft drivers (SQL server and JET) ship with Windows, but you have to
>> hunt for the others. For my testing, I use the "MySQL ODBC 5.1 Driver".
>> You can find it at http://dev.mysql.com/downloads/connector/odbc/5.1.html
>>
>> Also, http://www.connectionstrings.com/ will shed more light on the black
>> magic of creating a working connection string.
>> --
>> Vernon
>>
>> On Tue, Jul 20, 2010 at 12:16 PM, Ian Hobson <ian at ianhobson.co.uk> wrote:
>>>
>>>     ...Testing MySql login...
>>> (-2147352567, 'Exception occurred.', (0, u'Microsoft OLE DB Provider for
>>> ODBC Dr
>>> ivers', u'[Microsoft][ODBC Driver Manager] Data source name not found and
>>> no def
>>> ault driver specified', None, 0, -2147467259), None)
>>>  Unit tests for adodbapi version 2.3.0
>>> Default Date Converter is <adodbapi.pythonDateTimeConverter object at
>>> 0x023D7610
>>> >
>>>
>>>
>>> On 20/07/2010 19:05, Vernon Cole wrote:
>>>
>>> I use MySQL as one of the basic tests for adodbapi, so I can say that it
>>> works pretty well for me.
>>> What obstacle do you hit?
>>> --
>>> Vernon Cole
>>>
>>> On Tue, Jul 20, 2010 at 11:52 AM, Ian Hobson <ian at ianhobson.co.uk> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> How can I (a nube) read a MySQL database using Iron Python? (windows 7
>>>> and 2008 Server).
>>>>
>>>> Any method will do, so long as it works. :)
>>>>
>>>> I've tried adodbapi and mysqldb and mysqlconnector - and always hit an
>>>> obstacle I can't get round.
>>>>
>>>> Regards
>>>>
>>>> Ian
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.ironpython.com
>>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com
>>> Version: 9.0.839 / Virus Database: 271.1.1/3017 - Release Date: 07/20/10
>>> 07:36:00
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com
>> Version: 9.0.839 / Virus Database: 271.1.1/3017 - Release Date: 07/20/10
>> 07:36:00
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>



More information about the Ironpython-users mailing list