Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle Support #51

Open
vlukereddy opened this issue Dec 8, 2014 · 9 comments
Open

Oracle Support #51

vlukereddy opened this issue Dec 8, 2014 · 9 comments

Comments

@vlukereddy
Copy link

You mentioned Oracle support in the list of oracle support but I can't quite figure it out. I tried dbtype="oracle" and "Oracle". I do have the Oracle package cx_oracle

@genfri
Copy link

genfri commented Dec 10, 2014

Do you want to test my fork with Oracle support (cx_oracle) ? https://github.com/genfri/db.py

@glamp
Copy link
Contributor

glamp commented Dec 10, 2014

I was told we had Oracle support, though I have no way of testing 😦

@reddy, let me know if genfri's fork is working

On Wed, Dec 10, 2014 at 9:19 AM, Gianluca Emireni [email protected]
wrote:

Do you want to test my fork with Oracle support (cx_oracle) ?
https://github.com/genfri/db.py


Reply to this email directly or view it on GitHub
#51 (comment).

@vlukereddy
Copy link
Author

Hi genfri, I will try it out. Though I am having issues with cx_Oracle itself. It is in my site-packages yet your fork is unable to detect it. I still think its an environment issue on my end. Has it worked for you?

raise Exception("Couldn't find cx_Oracle library. Please ensure it is installed")
Exception: Couldn't find cx_Oracle library. Please ensure it is installed
>>> exit()

C:\Users\Administrator\Documents\db.py-master
λ pip install cx_Oracle
Requirement already satisfied (use --upgrade to upgrade): cx-Oracle in c:\python27\lib\site-packages
Cleaning up...

@genfri
Copy link

genfri commented Dec 10, 2014

Hi @vlukereddy, on my linux box the fork is working.
What happens when you try to

import cx_Oracle

directly from python shell ?

@vlukereddy
Copy link
Author

@genfri Yeah thats what I meant when I thought it was an environment issue on my side. I actually never used Oracle with Python before I have only used MySQL and Postgres and I never encountered the issues when installing those packages as binaries. I have another Windows environment with VS 2008 installed so I can compile directly. I will try that and let you know. Thanks so much.

>>> import cx_Oracle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

@genfri
Copy link

genfri commented Dec 11, 2014

@vlukereddy
Which version of oracle db are you using? The fork works for the 12g, but I think that the underlying structure is the same in the previous versions.

I also had some issues connecting oracle and python in Windows environments, so I followed these steps:

  • download and unzip (e.g. C:\oracle\instantclient_11_2) instantclient-basic-nt-11.2.0.4.0 from oracle website
  • set env variables
    ORACLE_HOME = C:\oracle\instantclient_11_2
    PATH = %PATH%;C:\oracle\instantclient_11_2
  • download and unzip in ORACLE_HOME instantclient SDK extension instantclient-sdk-nt-11.2.0.4.0 (I think it's not mandatory)
  • installed cx_Oracle MSI file (http://sourceforge.net/projects/cx-oracle/), because pip and setup.py didn't work for me
  • create NETWORK/ADMIN subdirs in ORACLE_HOME
  • create TNSNAMES.ORA in ADMIN subdir (http://www.orafaq.com/wiki/Tnsnames.ora)

I hope it can help you.

@selepo
Copy link

selepo commented Jan 5, 2015

@genfri
I'm not getting this to work either :(
Are you sure the patch is committed in version 0.3.5 (latest) ? Shouldn't /db/queries/ include a file for Oracle ?

import cx_Oracle as odb
from db import DB
db = DB(username="_", password="_", hostname="***",
dbtype="oracle")
db.tables

gives me...

AttributeError Traceback (most recent call last)
in ()
1 # Connect to ***
2 db = DB(username="_", password="", hostname="**",
----> 3 dbtype="oracle")
4 #db.save_credentials(profile="_")
5 #db = DB(profile="
*")

C:\WinPython3\python-3.4.2\lib\site-packages\db\db.py in init(self, username, password, hostname, port, filename, dbname, dbtype, schemas, profile, exclude_system_tables, limit, keys_per_column)
761 if self.dbtype is None:
762 raise Exception("Database type not specified! Must select one of: postgres, sqlite, mysql, mssql, or redshift")
--> 763 self._query_templates = queries_templates.get(self.dbtype).queries
764
765 if self.dbtype=="postgres" or self.dbtype=="redshift":

AttributeError: 'NoneType' object has no attribute 'queries'

@genfri
Copy link

genfri commented Jan 7, 2015

I think that Oracle support is not included in the master repo, you should
try a fork like this: https://github.com/genfri/db.py.
I made it about 2 months ago and tested on Oracle 11g.

On Mon, Jan 5, 2015 at 4:14 PM, selepo [email protected] wrote:

@genfri https://github.com/genfri
I'm not getting this to work either :(
Are you sure the patch is committed in version 0.3.5 (latest) ? Shouldn't

/db/queries/ include a file for Oracle ?

import cx_Oracle as odb
from db import DB
db = DB(username="", password="", hostname="***",
dbtype="oracle")
db.tables gives me...

AttributeError Traceback (most recent call last)
in ()
1 # Connect to ***
2 db = DB(username="", password="", hostname="

", ----> 3 dbtype="oracle") 4 #db.save_credentials(profile="")
5 #db = DB(profile="***")

C:\WinPython3\python-3.4.2\lib\site-packages\db\db.py in init(self,
username, password, hostname, port, filename, dbname, dbtype, schemas,
profile, exclude_system_tables, limit, keys_per_column)
761 if self.dbtype is None:
762 raise Exception("Database type not specified! Must select one of:
postgres, sqlite, mysql, mssql, or redshift")
--> 763 self._query_templates = queries_templates.get(self.dbtype).queries
764
765 if self.dbtype=="postgres" or self.dbtype=="redshift":
AttributeError: 'NoneType' object has no attribute 'queries'


Reply to this email directly or view it on GitHub
#51 (comment).

Gianluca Emireni

mobile: +39 340 7910213
email: [email protected]
gtalk: [email protected]
twitter: @gianlucaemireni

@wbashir
Copy link

wbashir commented Jan 12, 2016

Can we get @genfri 's fork merged for official support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants