好吧,我希望这不是重复的,搜索没有产生任何有用的东西。
cx_Oracle
这几天我一直在玩弄,安装和使用它。一切都很顺利,直到我遇到了当前的问题:我想更改我的架构。如果我使用 sqlplus 一个简单的 'alter session set current_schema=toto;' 会做,但我不知道如何解决它cx_Oracle
。
我已经下载了最新的源代码版本:cx_Oracle-5.0.2.tar.gz。
根据文档更改架构是一个简单的设置案例Connection.current_schema
,应该是一个读写属性......问题是我的Connection
对象没有任何current_schema
属性。
>>> c = cx_Oracle.connect(...)
>>> dir(c)
['__class__', '__delattr__', '__doc__', '__enter__', '__exit__', '__format__',
'__getattribute__', '__hash__', '__init__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
'__subclasshook__', 'autocommit', 'begin', 'cancel', 'changepassword', 'close',
'commit', 'cursor', 'dsn', 'encoding', 'inputtypehandler',
'maxBytesPerCharacter', 'nencoding', 'outputtypehandler', 'password', 'prepare',
'register', 'rollback', 'stmtcachesize', 'tnsentry', 'unregister', 'username',
'version']
尝试使用设置属性
>>> c.current_schema = 'toto'
导致错误...__setattr__
显然已被覆盖以防止它。
所以...有人知道怎么做吗?
这是我得到的错误。
>>> c.current_schema = 'toto'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'cx_Oracle.Connection' object has no attribute 'current_schema'
>>> setattr(c, 'current_schema', 'toto')
# same error
以下是有关 OS 和 python 的信息:
SUSE LINUX Enterprise Server 9 (x86_64)
VERSION = 9
PATCHLEVEL = 3
我使用python 2.6.2(编译为64位)
cx_Oracle
我还在同一台机器上编译了 64 位。