Index
2009-07-03 05:56 – Roger Gammans : [dabo-users] Odbc and Bizobj's
2009-07-03 09:14 – Ed Leafe : Re: [dabo-users] Odbc and Bizobj's
2009-07-03 10:32 – Roger Gammans : Re: [dabo-users] Odbc and Bizobj's
2009-07-06 10:49 – Roger Gammans : Re: [dabo-users] Odbc and Bizobj's
2009-07-13 09:31 – Roger Gammans : Re: [dabo-users] Odbc and Bizobj's
2009-07-13 10:20 – Ed Leafe : Re: [dabo-users] Odbc and Bizobj's
2009-07-13 12:08 – Roger Gammans : Re: [dabo-users] Odbc and Bizobj's
Back to top
[dabo-users] Odbc and Bizobj's

Author: Roger Gammans

Posted: 2009-07-03 05:56:36   Link

Hi

Has anyone made any progress on this, It looks like

it going to be the simplest way for my to complete the project I;'ve

got here. (Which has some small interaction will a legacy odbc system)

If there is any alpha/beta code for this lying around or shall I

start from scratch?

--

Roger. Home| http://www.sandman.uklinux.net/

Master of Peng Shui. (Ancient oriental art of Penguin Arranging)

Work|Independent Sys Consultant | http://www.computer-surgery.co.uk/

New key Fpr: 72AF 0ACC 9A53 E59F B1B6 DC14 1983 A13E 5C3D 3CEB

©2009 Roger Gammans
Back to top
Re: [dabo-users] Odbc and Bizobj's

Author: Ed Leafe

Posted: 2009-07-03 09:14:41   Link

On Jul 3, 2009, at 4:56 AM, Roger Gammans wrote:

> Has anyone made any progress on this, It looks like

> it going to be the simplest way for my to complete the project I;'ve

> got here. (Which has some small interaction will a legacy odbc system)

>

> If there is any alpha/beta code for this lying around or shall I

> start from scratch?

I haven't worked on it, as I never use ODBC. I'm not aware of any

code along these lines, but I'll be happy to assist you wherever

possible; take a look at the db/dbTemplate.py, which is intended to be

the template for new backend connection scripts.

-- Ed Leafe

©2009 Ed Leafe
Back to top
Re: [dabo-users] Odbc and Bizobj's

Author: Roger Gammans

Posted: 2009-07-03 10:32:40   Link

On Fri, Jul 03, 2009 at 08:14:41AM -0500, Ed Leafe wrote:

> code along these lines, but I'll be happy to assist you wherever

> possible; take a look at the db/dbTemplate.py, which is intended to be

> the template for new backend connection scripts.

Cool. I found that while I was waiting for a reply so it looks

good.

I've got a start point here I'm about to test.

TTFN

--

Roger. Home| http://www.sandman.uklinux.net/

Master of Peng Shui. (Ancient oriental art of Penguin Arranging)

Work|Independent Sys Consultant | http://www.computer-surgery.co.uk/

New key Fpr: 72AF 0ACC 9A53 E59F B1B6 DC14 1983 A13E 5C3D 3CEB

©2009 Roger Gammans
Back to top
Re: [dabo-users] Odbc and Bizobj's

Author: Roger Gammans

Posted: 2009-07-06 10:49:22   Link

On Fri, Jul 03, 2009 at 03:32:40PM +0100, Roger Gammans wrote:

> On Fri, Jul 03, 2009 at 08:14:41AM -0500, Ed Leafe wrote:

> > code along these lines, but I'll be happy to assist you wherever

> > possible; take a look at the db/dbTemplate.py, which is intended to be

> > the template for new backend connection scripts.

>

> Cool. I found that while I was waiting for a reply so it looks

> good.

>

> I've got a start point here I'm about to test.

Ok, What I've done pass my basic tests, (eg, calling

the new class directely gets sensible results. I now

have to try it in action.

(

My development is is here http://hg.backslashat.org/repos/dabo-odbc

current new module is at: -

http://hg.backslashat.org/repos/dabo-odbc/file/807cb91fc495/dabo/db/dbOdbc.py

)

I can forsee a slight problem with creating the connection as

Odbc connections all require either a Driver of a DSN parameter

entry. Neither of which are in known by dConnectInfo.

Do I need to teach it about these? And is athere any where else

that needs two know about these extra parameters?

TTFN

--

Roger. Home| http://www.sandman.uklinux.net/

Master of Peng Shui. (Ancient oriental art of Penguin Arranging)

Work|Independent Sys Consultant | http://www.computer-surgery.co.uk/

New key Fpr: 72AF 0ACC 9A53 E59F B1B6 DC14 1983 A13E 5C3D 3CEB

©2009 Roger Gammans
Back to top
Re: [dabo-users] Odbc and Bizobj's

Author: Roger Gammans

Posted: 2009-07-13 09:31:20   Link

On Fri, Jul 03, 2009 at 08:14:41AM -0500, Ed Leafe wrote:

> code along these lines, but I'll be happy to assist you wherever

> possible; take a look at the db/dbTemplate.py, which is intended to be

> the template for new backend connection scripts.

Ok, So far so good. I've had to make changes to the ConnectionInfo and

XML reader as discussed in a previos email.

However I'm hitting a problem with dCursorMixin - it seems to

expect the records return to be of type tuple,list or dict-compatible.

pyodbc returns records of type pyodbc.Row which offers list/tuple style access

rather than dict style.

This means the test at line 358 of dCursorMixin.py (svn:r5293) takes

the wrong branch and the code in the other branch won't work as pyodbc.Row

hasn't a items() methods and the __getitems__ method requires an in parameter.

Is there anyway we could force dCursorMixin to take the other branch

in this by adding a flag ? Would that be acceptable?

TTFN

--

Roger. Home| http://www.sandman.uklinux.net/

Master of Peng Shui. (Ancient oriental art of Penguin Arranging)

Work|Independent Sys Consultant | http://www.computer-surgery.co.uk/

New key Fpr: 72AF 0ACC 9A53 E59F B1B6 DC14 1983 A13E 5C3D 3CEB

©2009 Roger Gammans
Back to top
Re: [dabo-users] Odbc and Bizobj's

Author: Ed Leafe

Posted: 2009-07-13 10:20:56   Link

On Jul 13, 2009, at 8:31 AM, Roger Gammans wrote:

> pyodbc returns records of type pyodbc.Row which offers list/tuple

> style access

> rather than dict style.

>

> This means the test at line 358 of dCursorMixin.py (svn:r5293) takes

> the wrong branch and the code in the other branch won't work as

> pyodbc.Row

> hasn't a items() methods and the __getitems__ method requires an in

> parameter.

>

> Is there anyway we could force dCursorMixin to take the other branch

> in this by adding a flag ? Would that be acceptable?

We would need to be able to reference the type of the returned value;

I assume that this Row class is defined in the pyodbc module. This

would mean that *everyone* would have to have that file installed.

Is there anyway to cast these Row values into tuples or lists? Some

dbapi adapters give a choice of classes: MySQLdb, for example, has a

DictCursor class that returns the query results as dicts rather than

tuples. You might even be able to wrap pyodbc with your own code to

automatically do the conversion, and we could use the wrapped class

instead of pyodbc directly.

If not, I can switch the logic around in dCursorMixin to check for

dicts, and do the conversion on all results that are not dicts. This

would be more disruptive and require more testing, so if you can

handle this case at the pyodbc level, that would be much easier. If

not, though, I think we can make the switch in dCursorMixin without

too much trouble.

-- Ed Leafe

©2009 Ed Leafe
Back to top
Re: [dabo-users] Odbc and Bizobj's

Author: Roger Gammans

Posted: 2009-07-13 12:08:47   Link

On Mon, Jul 13, 2009 at 09:20:56AM -0500, Ed Leafe wrote:

> We would need to be able to reference the type of the returned value;

> I assume that this Row class is defined in the pyodbc module. This

> would mean that *everyone* would have to have that file installed.

Ah . No we don't want that .

> Is there anyway to cast these Row values into tuples or lists?

D'oh.

Yes a simple cast works fine. It's a bit slow on large datasets as we

have to loop round the results twice. But I hope not to be selecting

the whole table most of the time.

Excellent I'll sort a patch out soon.

TTFN

--

Roger. Home| http://www.sandman.uklinux.net/

Master of Peng Shui. (Ancient oriental art of Penguin Arranging)

Work|Independent Sys Consultant | http://www.computer-surgery.co.uk/

New key Fpr: 72AF 0ACC 9A53 E59F B1B6 DC14 1983 A13E 5C3D 3CEB

©2009 Roger Gammans