Michael R Seefelt | 2 Jun 15:45 2004
Picon

C-program-≥Python->mxDateTime Problem

I have written a simple C-program that loads a Python Function that
connects to a PostgreSQL database> When I only load and execute the
Python function all works OK. If I call the Python function a second
time I get the following:
Called PyObject_CallObject
Traceback (most recent call last):
  File
"/home/mike/src/arthur/query_server/query_analyzer/Query_Analyzer.py",
line 25, in processQuery
    from pyPgSQL import PgSQL
  File "/usr/local/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line
388, in ?
    raise ImportError, \
ImportError: You need to install mxDateTime
        (http://www.egenix.com/files/python/eGenix-mx-Extensions.html)

Any ideas?

Thanks, Mike

_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
http://lists.egenix.com/mailman/listinfo/egenix-users

Charlie Clark | 2 Jun 16:10 2004

Re: Problem w/ mxDateTime in activestate python 2.3

Bobb wrote:

>  
> Hi Charlie, bobb from the zope list her.
> I'm having a problem w/ the mxdatetime module (actually other 
> site-packages...) using activestate 2.3 build 232 on winxp.
> When mx is in the pythonpath, nothing happens when I run a script.
>  
> is there a techsupport email I can email my problem to.?
>  
>  
>  
> thanks in advance.
> bobb

Hi Bobb,

you can write to support@... but we only support mxDateTime on a 
consulting basis - support tickets can be purchased on the website. 
Another alternative is to try the egenix-users lists which I'm cc'ing. 
Have you tried things with a standard Python installation?

Charlie

_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
http://lists.egenix.com/mailman/listinfo/egenix-users

Joseph Kocherhans | 11 Jun 23:11 2004
Picon

sql server right truncation for long column names

I kept getting the following error from while trying to execute a
query:

mxODBC.Warning: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]String
data, right truncation', 2394)

and after adding each column in the query one by one, it looks like I
get the error only when the name of the column is over 38 chars. Can
anyone confirm this? If so is there a chance of getting it changed?
Unfortunately I'm not in charge of the db structure or I'd just rename
the offending columns.

SQL Server 2000 SP3
egenix-mx-commercial-2.0.6.win32-py2.3.exe
python 2.3.3

Thanks,
Joseph

_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
http://lists.egenix.com/mailman/listinfo/egenix-users

M.-A. Lemburg | 14 Jun 09:54 2004

Re: C-program-≥Python->mxDateTime Problem

Michael R Seefelt wrote:
> I have written a simple C-program that loads a Python Function that
> connects to a PostgreSQL database> When I only load and execute the
> Python function all works OK. If I call the Python function a second
> time I get the following:
> Called PyObject_CallObject
> Traceback (most recent call last):
>   File
> "/home/mike/src/arthur/query_server/query_analyzer/Query_Analyzer.py",
> line 25, in processQuery
>     from pyPgSQL import PgSQL
>   File "/usr/local/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line
> 388, in ?
>     raise ImportError, \
> ImportError: You need to install mxDateTime
>         (http://www.egenix.com/files/python/eGenix-mx-Extensions.html)
> 
> Any ideas?

Install egenix-mx-base ?!

--

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jun 14 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
(Continue reading)

Charlie Clark | 14 Jun 16:45 2004

Re: sql server right truncation for long column names


On 2004-06-11 at 23:11:36 [+0200], Joseph Kocherhans 
<Joseph.Kocherhans@...> wrote:
> I kept getting the following error from while trying to execute a
> query:
> 
> mxODBC.Warning: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]String
> data, right truncation', 2394)
> 
> and after adding each column in the query one by one, it looks like I
> get the error only when the name of the column is over 38 chars. Can
> anyone confirm this? If so is there a chance of getting it changed?
> Unfortunately I'm not in charge of the db structure or I'd just rename
> the offending columns.
> 
> SQL Server 2000 SP3
> egenix-mx-commercial-2.0.6.win32-py2.3.exe
> python 2.3.3

Hi Joseph,

this is a pretty common scenario.

This is a comment in our source:
"""
/* ANSI SQL defines that column and table names may have at most 18
    characters (a column may be described using <table>.<column> which
    makes 37 characters in total + 1 for the terminating 0-byte).  Some
    databases also allow longer names, so this limit is an adjustable
	parameter. Set the value to 1 + max. length in characters. */
(Continue reading)

M.-A. Lemburg | 14 Jun 20:37 2004

eGenix EuroPython Talks Online

Just in case it interests you: we have put our EuroPython 2004
talks on the web-site.

* Developing large-scale applications in Python:
http://www.egenix.com/files/python/EuroPython2004-Developing-large-scale-applications-in-Python.pdf

* How Python is developed:
http://www.egenix.com/files/python/EuroPython2004-How-Python-is-developed.pdf

You can find the other EuroPython talks in the Python wiki at:
http://www.python.org/cgi-bin/moinmoin/EuroPython2004Slides

Some older eGenix talks that might still be of interest to you:

* Python and Unicode:
http://www.egenix.com/files/python/EuroPython2002-Python-and-Unicode.pdf

* Python Database APIs:
http://www.egenix.com/files/python/EuroPython2002-Python-Database-APIs.pdf

Enjoy,
--

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jun 14 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
(Continue reading)

Jerome R. Westrick | 16 Jun 01:54 2004

Open and Closing mxodbcZopeda via script

Can someone tell me how to open, and 
close connections within a python script?

Can't seem to manage it...

Jerry

_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
http://lists.egenix.com/mailman/listinfo/egenix-users

Steve Holden | 16 Jun 02:03 2004
Picon

Re: Open and Closing mxodbcZopeda via script

Jerome R. Westrick wrote:

>Can someone tell me how to open, and 
>close connections within a python script?
>
>Can't seem to manage it...
>
>Jerry
>  
>
I use something like

import mx.ODBC.Windows as db
conn = db.connect("sitedata")
curs = conn.cursor()
    ...
conn.close()

where "sitedata"  is a defined ODBC Data Source Name in Windows 
connection manager.

Now I guess you'll tell me you meant Linux ...

You can also use the DriverConnect() method to use DSN-less connections.

regards
 Steve

_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
(Continue reading)

Lyons, Andrew Myers | 21 Jun 20:52 2004
Picon

ms sql server examples?

Hi,

I'm trying to use mxodbc on unix with a ms sql server running on 
windows 2k server, as part of some medical research.  I learn best 
by example, and would greatly appreciate if anyone could send me a 
sample python script that has any relevance to my situation. 
[andrew.m.lyons@...]

Best,

Andrew

---------------------------------------
Lyons, Andrew Myers
Vanderbilt University
Email: andrew.m.lyons@...

_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
http://lists.egenix.com/mailman/listinfo/egenix-users

Steve Holden | 21 Jun 21:19 2004
Picon

Re: ms sql server examples?

Lyons, Andrew Myers wrote:

> Hi,
>
> I'm trying to use mxodbc on unix with a ms sql server running on 
> windows 2k server, as part of some medical research.  I learn best by 
> example, and would greatly appreciate if anyone could send me a sample 
> python script that has any relevance to my situation. 
> [andrew.m.lyons@...]
>
I don't know whether this will server, it's a copy of a program I use to 
copy the contents of a remote database to a local one. At least it shows 
you mx.ODBC in action. Others may have more illuminating examples for you.

regards
 Steve

#
# FraudCopy.py: gets a local copy of the OnePlus database
#
# XXX NOTE: this program is EXTREMELY FRAGILE: it's a modified copy of
# XXX       dbImport.py solely to copy the contents of the fraud table
#
import mx.DateTime as dt

import mx.ODBC.Windows
def RMinit():
    conn = mx.ODBC.Windows.DriverConnect("""Driver={SQL Server};Server=THEHEART;Database=GPWeb;Uid=USERNAME;Pwd=PASSWORD;""")
(Continue reading)


Gmane