FAQ

Jo?o wrote:
Hi.

Can someone guide me into getting this to work? It's just really
querying a DB of an Autodiscovery tool to have a bunch of updated dns
files.
(Thought I'm still building the first script steps) I was able to
successfully query the DB against a single groupid, but am failing in
passing a list of integers into the sql query.

I'm failing miserably in,

sql = '''SELECT ip, host, dns FROM zabbix_tst_db.hosts WHERE hostid IN
(
select hostid from hosts_groups WHERE groupid IN (' +
','.join(map(str, %s)) + ')''' % grp_range


with
_mysql_exceptions.ProgrammingError: (1064, "You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '' at line 1")
[snip]
The triple-quoted string starts at:

'''SELECT ...

and ends at:

...)''' % grp_range

which means that the part where you do the .join is _inside_ the string.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedMar 1, '10 at 5:54p
activeMar 1, '10 at 7:04p
posts3
users3
websitepython.org

3 users in discussion

MRAB: 1 post Rami Chowdhury: 1 post João: 1 post

People

Translate

site design / logo © 2022 Grokbase