Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16449
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!news-transit.tcx.org.uk!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rodperson@rodperson.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.023 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'ide': 0.05; 'rod': 0.07; 'sql.': 0.07; '%s"': 0.09; 'executes': 0.09; 'cc:name:python list': 0.16; 'privilege': 0.16; 'cc:addr:python-list': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'input': 0.22; 'header:In-Reply- To:1': 0.22; '-0500': 0.23; 'role,': 0.23; 'cc:2**0': 0.24; 'code': 0.25; '(in': 0.26; 'code.': 0.26; "i'm": 0.26; 'import': 0.27; 'script': 0.28; 'start,': 0.29; 'problem': 0.29; 'print': 0.29; 'cc:addr:python.org': 0.29; 'error': 0.29; 'nov': 0.29; 'environment': 0.30; 'roles': 0.30; 'skip:% 10': 0.30; 'anyone': 0.31; "i've": 0.31; 'does': 0.32; 'null': 0.34; 'changing': 0.35; 'something': 0.35; 'file': 0.36; 'data.': 0.36; 'club': 0.37; 'received:128': 0.37; 'doing': 0.38; 'correctly': 0.39; 'version:': 0.39; 'should': 0.39; 'appreciated.': 0.39; 'why': 0.39; '2011': 0.61; 'collect': 0.61; 'double': 0.61; 'connect': 0.62; 'union': 0.72; '"full': 0.84; '#!/bin/bash': 0.84; 'subject:SQL': 0.84; 'concluding': 0.93 |
| Date | Wed, 30 Nov 2011 15:37:44 -0500 |
| From | Rod Person <rodperson@rodperson.com> |
| To | Verde Denim <tdldev@gmail.com> |
| Subject | Re: Py and SQL |
| In-Reply-To | <CAB3cKwzodsPqE-sTh6borkxHccgqdbKMToMrR1CpU4_WdqGmfQ@mail.gmail.com> |
| References | <CAB3cKwzodsPqE-sTh6borkxHccgqdbKMToMrR1CpU4_WdqGmfQ@mail.gmail.com> |
| X-Mailer | Claws Mail 3.7.10cvs7 (GTK+ 2.16.6; i586-pc-mingw32msvc) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | Python list <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3171.1322685990.27778.python-list@python.org> (permalink) |
| Lines | 54 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1322685990 news.xs4all.nl 6944 [2001:888:2000:d::a6]:38063 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:16449 |
Show key headers only | View raw
On Wed, 30 Nov 2011 15:30:48 -0500
Verde Denim <tdldev@gmail.com> wrote:
> All
> I have a sql script that I've included in a simple Py file that gives
> an error in the SQL. The problem is that the SQL code executes
> correctly in a database IDE environment (in this case ora developer).
> So, I'm concluding that I'm doing something amiss in the Py code.
> Does anyone see why this code would return a 'missing expression' sql
> error? Essentially, the code should start, ask for a privilege, and
> then collect the priv, role, and user data. Any input is appreciated.
>
> #!/bin/bash
> import time
> import cx_Oracle
>
> dbConn = cx_Oracle.connect('juser', 'pass', '1.2.3.4:/orcl:DEDICATED',
> cclass = "ABC", purity = cx_Oracle.ATTR_PURITY_SELF)
>
> pStart = time.time()
>
> dbVersion = dbConn.version.split(".")
>
> majVer = dbVersion[0]
>
> print "Oracle Version: %s" %(majVer)
> print "Full Version: %s" %(dbConn.version)
>
> dbCursor1 = dbConn.cursor()
> dbCursor1.execute('select lpad(' ', 2*level) || c "Privilege, Roles
> and Users" from ( select null p, name c from system_privilege_map
> where name like upper(\'%&enter_privliege%\') union select
> granted_role p, grantee c from dba_role_privs union select privilege
> p, grantee c from dba_sys_privs) start with p is null connect by p =
> prior c') dbRowResult = dbCursor1.fetchall()
> for dbRow in dbRowResult:
> print dbRow
>
Try changing the wrapping ' ' to " " and the inside double qoutes to
single, like this
dbCursor1.execute("select lpad(' ', 2*level) || c 'Privilege, Roles
and Users' from ( select null p, name c from system_privilege_map
where name like upper(\'%&enter_privliege%\') union select
granted_role p, grantee c from dba_role_privs union select privilege
p, grantee c from dba_sys_privs) start with p is null connect by p =
prior c")
--
Rod
The club is like groceries, and I jus bag a bi@$&!
Santonio Holmes on the Twitter
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Py and SQL Rod Person <rodperson@rodperson.com> - 2011-11-30 15:37 -0500
csiph-web