Python: Text file insert to MySQL
Gerhard Häring
gh at ghaering.de
Wed Oct 7 07:39:29 EDT 2009
On Wed, Oct 7, 2009 at 1:32 PM, Schedule <sschedule at gmail.com> wrote:
> That was great ! Now I am able to insert the values from the file.
>
> Somehow I am not able to update a specific field with all the vaues in the
> file. For eg:
> [...]
> c.execute("UPDATE a SET last = %s", row)
The database does what you say, not what you mean ;-)
SQL commands like SELECT, UPDATE, DELETE work on sets. If you don't
qualify the set any further, you always operate on the whole set.
To restrict the set, apply a WHERE clause. I. e.
Perhaps you should try a SQL tutorial before jumping into SQL +
Python. Here's one:
http://sqlzoo.net/
-- Gerhard
More information about the Python-list
mailing list