cx-oracle

AWS Python Lambda with Oracle - OID Generation Failed even after adding HOSTALIASES

蹲街弑〆低调 提交于 2019-12-11 17:17:41
问题 I am trying to connect to oracle on rds using lambda with python using cx_oracle package but i get: ORA-21561: OID generation failed: DatabaseError. Even after adding file /tmp/HOSTALIASES with the lambda-server-name localhost . Also added HOSTALIASES to lambda environment variables . Referd from: AWS Python Lambda with Oracle - OID Generation Failed. How to resolve this OID generation problem in aws lambda Here is my code import cx_Oracle import os import sys import time # sys.path.append(

DPI-1050: Oracle Client library is at version 0.0 but version 11.2 or higher is needed

ぐ巨炮叔叔 提交于 2019-12-11 16:12:52
问题 I'm trying to connect to my work's remote DB but when I run the python script it shows this error. I already did everything this guide says I should have as requirements but the error keeps showing. I've tried to connect through sql* and it works as it should. I downloaded oracle client libraries 12.2 (32 bits version since it needs to have the same architecture as python), I'm working with Oracle Database 11g version 11.2.0.3, Python 3.7 and I already installed Visual Studio Redistributable

How connect to database to extract data and write pandas dataframe

こ雲淡風輕ζ 提交于 2019-12-11 15:52:27
问题 I have to connect oracle database to extract data and write into pandas data frame. All I have available with me is Hostname , Port, Service Name import cx_Oracle Hostname = 'XX.XX.X.XXX' port = 1521 Service_Name = 'DPP2.kn.com' dsn_tns = cx_Oracle.makedsn(Hostname, port, Service_Name) connection = cx_Oracle.connect('BA', 'PASSWORD', dsn_tns) Its not working.How to fix this 回答1: You can use cx_Oracle.connect method as dsn_tns = cx_Oracle.connect(username+"/"+password+"@"+ Hostname+":"+port+"/

Extract data from User defined type via cx_Oracle

☆樱花仙子☆ 提交于 2019-12-11 15:29:34
问题 I am trying to extract data from User defined type (UDT) via cx_Oracle. Here is the UDT structure: CREATE OR REPLACE TYPE graphic_component AS OBJECT ( type NUMBER(6), source_type NUMBER(4), meta_type_id VARCHAR2(50 CHAR), name VARCHAR2(100 CHAR), extension_info VARCHAR2(500 CHAR), symbology_tokens VARCHAR2(2000 CHAR) ); CREATE OR REPLACE TYPE graphic_component_array AS VARRAY (10000) OF graphic_component; Here is an example using Python: >>>insert = cursor.execute("SELECT COMPLEX FROM

cx_Oracle: ImportError: DLL load failed: The specified procedure could not be found

橙三吉。 提交于 2019-12-11 11:12:35
问题 I have suddenly got a problem that I can no longer import cx_Oracle in python. I know that a lot of people have had a similar error message as mine, which is: The specified PROCEDURE could not be found. I was wondering if there are any ways to trouble shoot this problem. I'm running - instantclient_12_1 - python 3.4 64 bit - cx_Oracle-5.2.1-12c.win-amd64-py3.4.exe I have set the path and ORACLE_HOME environment variables to mmy instaclint 12_1 folder. What else could be the problem? The

Named Parameters in SQL Queries - cx_Oracle - ORA-01460: unimplemented or unreasonable conversion requested

偶尔善良 提交于 2019-12-11 09:43:14
问题 I have encountered a problem after implementing the named parameters in RAW SQL Queries as per Python DB-API. Earlier, my code was as follows (and this works fine, both on my DEV Server and my Client's test server) cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) I changed it to the following cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) This changed version (with named parameters) works

loading huge XLS data into Oracle using python

别说谁变了你拦得住时间么 提交于 2019-12-11 09:09:29
问题 I have a 3+ million record XLS file which i need to dump in Oracle 12C DB (direct dump) using a python 2.7. I am using Cx_Oracle python package to establish connectivity to Oracle , but reading and dumping the XLS (using openpyxl pckg) is extremely slow and performance degrades for thousands/million records. From a scripting stand point used two ways- I've tried bulk load , by reading all the values in array and then dumping it using cursor prepare (with bind variables) and cursor fetchmany

pypy: positional and named binds cannot be intermixed

谁都会走 提交于 2019-12-11 08:37:27
问题 I've successfully installed cx_Oracle on pypy using official patch. Now, everytime, django tries to execute any sql, I'm getting: MyTable.objects.using("ora").count() Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/user/.virtualenvs/pypy_chembl_migration/site-packages/django/db/models/query.py", line 351, in count return self.query.get_count(using=self.db) File "/home/user/.virtualenvs/pypy_chembl_migration/site-packages/django/db/models/sql/query.py",

Exporting Dataframe to Oracle: TypeError

拜拜、爱过 提交于 2019-12-11 07:01:14
问题 I am repeatedly failing to export the following Dataframe to my Oracle table: final df is: S USTAINABLE H ARVEST S ECTOR| QUOTA LISTING JUN 11 2013 Unnamed: 1 \ 2 6/4/13 130196 3 5/28/13 130158 4 6/4/13 130210 5 5/14/13 130079 6 6/4/13 130187 7 6/4/13 130208 8 6/11/13 130249 9 6/4/13 130204 10 5/28/13 130148 11 5/28/13 130149 12 5/28/13 130157 13 5/21/13 130105 14 5/21/13 130106 15 6/4/13 130205 16 6/11/13 130250 17 6/4/13 130206 18 6/11/13 130248 19 QUOTA TO BUY 0 20 DATE TRADE ID 21 6/11/13

strange Oracle error: “invalid format text”

放肆的年华 提交于 2019-12-11 06:48:25
问题 I'm trying to fetch some data from a column whose DATA_TYPE=NUMBER(1,0) with this piece of code: import cx_Oracle conn = cx_Oracle.connect(usr, pwd, url) cursor = conn.cursor() cursor.execute("SELECT DELETED FROM SERVICEORDER WHERE ORDERID='TEST'") print(cursor.fetchone()[0]) which complains thus: Traceback (most recent call last): File "main.py", line 247, in <module> check = completed() File "main.py", line 57, in completed deleted = cursor.fetchone()[0] cx_Oracle.DatabaseError: OCI-22061: