Re: [Tutor] MySQLdb question.

2006-07-28 Thread shawn bright
you may be missing db.commit(). When you do insert, update, etc.. you call commit() to make the changes stick.-skOn 7/28/06, Kent Johnson < [EMAIL PROTECTED]> wrote:Ron Phillips wrote:> I am trying to write a script that adds data to a table using > MySQLdb.py.  For some reason, "INSERT" seems to w

Re: [Tutor] MySQLdb question.

2006-07-28 Thread Ron Phillips
That was it all right! Thanks, Kent! Ron___Ron Phillips wrote: > I am trying to write a script that adds data to a table using > MySQLdb.py. For some reason, "INSERT" seems to work temporarily. I > run a command to insert a row, and then do a select query, and it's > there. Aft

Re: [Tutor] MySQLdb question.

2006-07-28 Thread Kent Johnson
Ron Phillips wrote: > I am trying to write a script that adds data to a table using > MySQLdb.py. For some reason, "INSERT" seems to work temporarily. I > run a command to insert a row, and then do a select query, and it's > there. After the program shuts down, though, it's gone. No rows are >

[Tutor] MySQLdb question.

2006-07-28 Thread Ron Phillips
I am trying to write a script that adds data to a table using MySQLdb.py.  For some reason, "INSERT" seems to work temporarily. I run a command to insert a row, and then do a select query, and it's there. After the program shuts down, though, it's gone. No rows are permanently created. SELECT wor

Re: [Tutor] MySQLdb question

2006-04-14 Thread Liam Clarke
On 4/15/06, Patty <[EMAIL PROTECTED]> wrote: > Hi, > > I have a data structure in a python file that looks something like this: > > my_map= { "host1": {"target1", "target2", "target3" }, >"host2": {"target4", "target5", "target6" }, > } > > I have a method that has two parame

Re: [Tutor] MySQLdb question

2006-04-14 Thread Patty
> > for ahost,target in my_map: > cursor.execute("""SELECT %s FROM targets > WHERE target_name in (%s) """ % (ahost, ",".join(target))) > Hi again, I'm confused :-( I'm using an old version of python (2.3.4). In my database, target_name is the name of a column, not the name of

Re: [Tutor] MySQLdb question

2006-04-14 Thread Allen John Schmidt, Jr.
Patty wrote: >I have a data structure in a python file that looks something like this: > >my_map= { "host1": {"target1", "target2", "target3" }, > "host2": {"target4", "target5", "target6" }, > } > >cursor.execute("""SELECT %s FROM targets >WHERE target_name = %s """ %

Re: [Tutor] MySQLdb question

2006-04-14 Thread Pujo Aji
I think you can wrap the select sql command with a function which return a string.this function receive a particular hostname in a string format and return the whole 'SELECT ... FROM.. WHERE' style including the hostname from the function argument. Cheers,pujoOn 4/14/06, Patty <[EMAIL PROTECTED]> w

[Tutor] MySQLdb question

2006-04-14 Thread Patty
Hi, I have a data structure in a python file that looks something like this: my_map= { "host1": {"target1", "target2", "target3" }, "host2": {"target4", "target5", "target6" }, } I have a method that has two parameteres (ahost, atarget), which I want to use to retrieve dat