cx-oracle

CSV to Oracle via Odo and SQL Alchemy

落爺英雄遲暮 提交于 2019-12-14 01:24:49
问题 I have this code that sends CSVs to Oracle but it's slower than molasses in January. I'd like to use odo but the documentation is scarce for this exact type of situation (data from CSV to Oracle). I'm not married to Pandas, so if it's better to not use it than that's fine with me. import pandas as pd import pandas.io.sql as psql from sqlalchemy import create_engine import cx_Oracle as cx engine = create_engine('oracle+cx_oracle://schema:'+pwd+'@server:port/service_name' ,encoding='latin1')

Return a stored procedure out cursor variable in cx_oracle

99封情书 提交于 2019-12-13 17:35:32
问题 I am trying to return a refcursor from a procedure in python using cx_oracle, my procedure looks something like the one below. below the procedure is the python that I am trying to use. when I run the script, all that is returned is DB: 0.00400018692017 seconds Total: 0.00400018692017 seconds <__builtin__.OracleCursor on <cx_Oracle.Connection to connection_string>> how can i iterate through the refcursor ? oracle documentation PROCEDURE prc_get_some_data( p_cursor OUT SYS_REFCURSOR) IS BEGIN

how to set oracle client library path in python when multiple oracle client version installed

帅比萌擦擦* 提交于 2019-12-13 08:38:05
问题 i have 2 oracle client installed in linux machine. 10.2 and 12.2. Second one i have to use for cx_oracle and older one is needed for other older implementation which i cant touch. when i add second 12.2 oracle client library in LD_LIBRARY_PATH path and running simple oracle connection python program, it is giving me below error cx_Oracle.DatabaseError: DPI-1050: Oracle Client library is at version 10.2 but must be at version 11.2 or higher How can i use the newer version of client library

Parse XML in python and add it to database

倾然丶 夕夏残阳落幕 提交于 2019-12-13 03:38:31
问题 I'm trying to write a Python script that will go through Rows and put them into my database This is a structure of my xml: Root> -<SvcNf> -<PersonNf> -<PersonList> -<Row> <SysName>MI6</SysName> <ServerDt>2016-10-28 03:00:12 +03:00</ServerDt> <UID>9457A55E17341AA7ASDEDS057A8BFFF3</UID> <PersID>007</PersID> <Emp_name>James Bond</Emp_name> <EventID>25</EventID> <EventTXT>Drinking alcohol</EventTXT> <CauseEventID>03</CauseEventID> <CauseEventTXT>Martini with vodka</CauseEventTXT> <EventBegda>2017

python: connecting to an Oracle database using Oracle's wallet/tnsnames

China☆狼群 提交于 2019-12-13 03:08:14
问题 So I can connect to an Oracle database as such: import cx_Oracle as ora dsnStr = ora.makedsn(host="ABC.COM", port="ABC_PORT", sid="ABC") con = ora.connect(user="ABC_USER", password="ABC_PASSWORD", dsn=dsnStr) print(con.version) con.close() and this works very well, but I would like to connect using the Oracle wallet / tnsnames / database.properties (I'm coming from the Java world). Couldn't find anything so far on how to achieve that. Also, how can I "configure" cx_Oracle in terms of the

Actual SQL statement after bind variables specified

穿精又带淫゛_ 提交于 2019-12-12 19:20:55
问题 I am trying to log every SQL statement executed from my scripts. However I contemplate one problem I can not overcome. Is there a way to compute actual SQL statement after bind variables were specified. In SQLite I had to compute the statement to be executed manually, using code below: def __sql_to_str__(self, value,args): for p in args: if type(p) is IntType or p is None: value = value.replace("?", str(p) ,1) else: value = value.replace("?",'\'' + p + '\'',1) return value It seems CX_Oracle

cx_Oracle does not recognize location of Oracle software installation for installation on Linux

北城余情 提交于 2019-12-12 16:21:34
问题 I have been able to successfully install cx_Oracle for use with Python 3.4 on my Windows 8 laptop, and I am now trying to get the same setup (cx_Oracle with Python 3.4) onto a Linux machine. When running the setup.py file from cx_Oracle-5.1.3.tar.gz, I end up with this error: sudo python3 setup.py install Traceback (most recent call last): File "setup.py", line 135, in <module> raise DistutilsSetupError("cannot locate an Oracle software " \ distutils.errors.DistutilsSetupError: cannot locate

python and cx_Oracle - dynamic cursor.setinputsizes

谁说胖子不能爱 提交于 2019-12-12 11:45:30
问题 I'm using cx_Oracle to select rows from one database and then insert those rows to a table in another database. The 2nd table's columns match the first select. So I have (simplified): db1_cursor.execute('select col1, col2 from tab1') rows = db1_cursor.fetchall() db2_cursor.bindarraysize = len(rows) db2_cursor.setinputsizes(cx_Oracle.NUMBER, cx_Oracle.BINARY) db2_cursor.executemany('insert into tab2 values (:1, :2)', rows) This works fine, but my question is how to avoid the hard coding in

How to use Pandas Write_Frame to export results to Oracle Database in cx_Oracle

泪湿孤枕 提交于 2019-12-12 08:42:54
问题 I am trying to export a Pandas DataFrame to an Oracle database. I have come across the Write_Frame function in Pandas which sounds like exactly what I need. However, I have done tons of searches online and just can't get it to work. I have imported cx_Oracle and can connect to the Oracle database as well as running SQL queries without any problems, but when I run this it gives me a ' NotImplementedError ': import pandas.io.sql as psql output = psql.write_frame(MyResults, name = 'MySchema

Anaconda 3.5 (64bit Windows) Install cx_Oracle

风格不统一 提交于 2019-12-12 07:57:33
问题 I have installed Anaconda 3.5 for Windows 64bits, and I need to connect to the Oracle database using package "cx_Oracle". I tried with the anaconda way: conda install -c https://conda.anaconda.org/anaconda cx_oracle The error messages below: Hint: the following packages conflict with each other: - cx_oracle - python 3.5* Use 'conda info cx_oracle' etc. to see the dependencies for each package. Note that the following features are enabled: - vc14 It seems that cx_oracle isn't compatible with