I was messing around with the native ODBC module (I am using Python in
a Win32 environment), e.g:
import dbi, odbc
....and it seems to meet my needs. I'd rather use a module that comes
natively with Python if it works (don't care about performance in this
particular use case; just that it works).
The only issue I've had so far is retrieving data from Oracle when an
integer has been defined like:
number(p) [same thing as number(p,0) evidently]
This is from a database I didn't design and can't change. Evidently
there are new ways to declare integer data types in Oracle.
The problem is that the ODBC module suffixes an "L" to any integer
returned that
was defined as data type number(p). For example, an integer stored as:
56 will be returned as 56L. Actually, it now seems to be doing the
same thing, at least in some cases, for number data types declared as
number(p,s). What gives? Anyone know why this would happen?
Can't use mxODBC because it's a commercial product and can't use
cx_oracle at the moment because I am stuck with Python 2.1 (for ESRI
geoprocessing), and there is no cx_oracle for Python 2.1 (starts with
Python 2.2 and refuses to install for 2.1). I could install a later
version of Python independently, but I need to be able to do the
geoprocessing that 2.1 allows as well as ODBC calls to Oracle all in
the same script. This means dbi,odbc seems to be my only choice.
Thanks for the help so far y'all. As a former Perl devotee, I now
worship at the altar of Python. 5 1832 da*****@yahoo.com wrote: I was messing around with the native ODBC module (I am using Python in a Win32 environment), e.g:
import dbi, odbc
...and it seems to meet my needs. I'd rather use a module that comes natively with Python if it works (don't care about performance in this particular use case; just that it works).
The only issue I've had so far is retrieving data from Oracle when an integer has been defined like:
number(p) [same thing as number(p,0) evidently]
This is from a database I didn't design and can't change. Evidently there are new ways to declare integer data types in Oracle.
The problem is that the ODBC module suffixes an "L" to any integer returned that was defined as data type number(p). For example, an integer stored as: 56 will be returned as 56L. Actually, it now seems to be doing the same thing, at least in some cases, for number data types declared as number(p,s). What gives? Anyone know why this would happen?
Well, it is a legal python umber literal. Fire up your python interpreter
and do long(1)
1L
It simply says that it is a long, not an int (which means 64 rather than 32
bits of precision I think)
So - no need to worry.
Diez
Great, thanks Diez! Should I just use str(n) to convert it to a format
I can write out to a flat file? I'm also struggling with the strange
date object format that the ODBC module returns when I fetch rows. I
need to convert that to a text string in a format that a mainframe
flatfile database requires. Any advice there?
Diez B. Roggisch wrote: da*****@yahoo.com wrote:
I was messing around with the native ODBC module (I am using Python in a Win32 environment), e.g:
import dbi, odbc
...and it seems to meet my needs. I'd rather use a module that comes natively with Python if it works (don't care about performance in this particular use case; just that it works).
The only issue I've had so far is retrieving data from Oracle when an integer has been defined like:
number(p) [same thing as number(p,0) evidently]
This is from a database I didn't design and can't change. Evidently there are new ways to declare integer data types in Oracle.
The problem is that the ODBC module suffixes an "L" to any integer returned that was defined as data type number(p). For example, an integer stored as: 56 will be returned as 56L. Actually, it now seems to be doing the same thing, at least in some cases, for number data types declared as number(p,s). What gives? Anyone know why this would happen?
Well, it is a legal python umber literal. Fire up your python interpreter and do
long(1)
1L
It simply says that it is a long, not an int (which means 64 rather than 32 bits of precision I think)
So - no need to worry.
Diez da*****@yahoo.com wrote: Great, thanks Diez! Should I just use str(n) to convert it to a format I can write out to a flat file? I'm also struggling with the strange
I guess so, yes.
date object format that the ODBC module returns when I fetch rows. I need to convert that to a text string in a format that a mainframe flatfile database requires. Any advice there?
No, I do use cx_Oracle - no strange dateformats there.
Diez
[posted & mailed] da*****@yahoo.com wrote: The only issue I've had so far is retrieving data from Oracle when an integer has been defined like:
number(p) [same thing as number(p,0) evidently]
This is from a database I didn't design and can't change. Evidently there are new ways to declare integer data types in Oracle.
The problem is that the ODBC module suffixes an "L" to any integer returned that was defined as data type number(p). For example, an integer stored as: 56 will be returned as 56L. Actually, it now seems to be doing the same thing, at least in some cases, for number data types declared as number(p,s). What gives? Anyone know why this would happen?
The 'L' suffix indicates a Python long, which is an arbitrary precision
integer. If you're confident that the number in question is in the
normal integer range, you can coerce it to a normal int with int(p) so
the formatting on display doesn't include the suffix - if the number
is too large to coerce an OverflowError will be raised (for 2.2 and
earlier at least; 2.4 and later unify ints and longs).
Can't use mxODBC because it's a commercial product and can't use cx_oracle at the moment because I am stuck with Python 2.1 (for ESRI geoprocessing), and there is no cx_oracle for Python 2.1 (starts with Python 2.2 and refuses to install for 2.1). I could install a later version of Python independently, but I need to be able to do the geoprocessing that 2.1 allows as well as ODBC calls to Oracle all in the same script. This means dbi,odbc seems to be my only choice.
If you have access to a compiler, you may be able to build cx_Oracle
for Python 2.1, but you would have to check that the code doesn't
require Python 2.2 or later features. The MingW gcc package should
work with
Python 2.1 (which was built with VC6 as I recall).
I've been bugging ESRI about upgrading, and I'm sure others have too.
-------------------------------------------------------------------------
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: an*****@bullseye.apana.org.au (pref) | Snail: PO Box 370 an*****@pcug.org.au (alt) | Belconnen ACT 2616
Web: http://www.andymac.org/ | Australia
Thanks Andrew. I've been bugging ESRI about upgrading, and I'm sure others have too.
The beta of ArcGIS Desktop 9.2 ships with Python 2.4, so I imagine the
release of ArcGIS Desktop 9.2 this summer will also ship with Python
2.4. I've read threads recently on the geoprocessing / scripting
support.esri.com of people using Python 2.4 successfully for
geoprocessing but I've not tried to install it yet.
Check out: http://forums.esri.com/Thread.asp?c=93&f=1729&t=157014
And also this support article: http://support.esri.com/index.cfm?fa...leShow&d=26872
Let me know if you have any luck with this.
Dana This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: eddie wang |
last post by:
Microsoft ODBC Driver 2.573 to retrieve Oracle Data, it is slow. How to
tune this? Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get...
|
by: SkunkDave |
last post by:
Is there a script anyone has that will automate the addition of an
access database to the OBDC datasources in control panel.
Thanks
|
by: Landley |
last post by:
Hi All,
Is there a method that I can call to return a list of available database
drivers?
If so, is there then a way to get the list of fields that are required for
those the database...
|
by: narasingarao |
last post by:
Hi to group,
I'm a student of M.C.A. from B.I.T. Ranchi...I'm in my project
period here i have to migrate the MS-Access database table to Oracle
data base tables...so, please help me in getting...
|
by: Adrian Schlesinger |
last post by:
Here is what happens (Windows 2000):
1. open the ODBC Data Source Administrator
2. go to the System DSN tab
3. then click Add - the Create Data Source screen pops up
4. select Microsoft Access...
|
by: Jean |
last post by:
Hi everyone,
I was hoping somebody could assist me in this issue. I am quite a
newbie to ODBC connections and was struggling to search for related
topics. Here is my situation:
I have a...
|
by: Jozef |
last post by:
Hello,
Is there any way to automatically create an ODBC data source if it doesn't
already exist?
I'd like to deploy this program on workstations that I may not have access
to, and don't want...
|
by: |
last post by:
Greetings All,
I'm trying to access a excel file using the odbc data adaptor but the tables arent showing up.
I can get connected to the excel file using the Wizard but when I go to do the odbc...
|
by: Peter Hann |
last post by:
As far as I know VisualStudio contains a MS built-in data provider for accessing
Oracle databases.
Is this built-in MS data provider only in the "full" VisualStudio Edition or in the Express...
|
by: Dom |
last post by:
Someone in a post mentioned the Oracle Data Provider. Can anyone tell
me about it? I'd like to know the following:
1. Is it much faster than OleDB?
2. Is it essentially the same approach,...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
| | |