On Sat, Aug 9, 2014 at 12:51 PM, John Gordon wrote:
> You probably meant something like this instead:
>
> sql = "DELETE FROM tblc_users WHERE user_email=%s" % line
>
> This will substitute the value of line for the %s.
>
> However, most (all?) SQL databases require string values to be enclosed
In Matt Smith
writes:
> I am trying to write a program that will loop through a text file and
> delete rows in a mysql database.
> It seemingly runs but I don't see anything getting deleted in the db.
> Is there anything apparent that I am missing?
> This is the code:
> #!/usr/bin/python
> im
On Fri, Aug 8, 2014 at 4:38 PM, Chris Angelico wrote:
> On Sat, Aug 9, 2014 at 8:01 AM, Chris Kaynor
> wrote:
> > However, I'd recommend re-raising the exception after rolling back the
> > transaction with a bare "raise" statement right after the db.rollback()
> - at
> > the absolute minimum, yo
On Fri, Aug 8, 2014 at 5:13 PM, Chris Angelico wrote:
> On Sat, Aug 9, 2014 at 9:55 AM, Chris Kaynor
> wrote:
> > try:
> > action
> > commit
> > finally:
> > rollback
>
> If commit/rollback automatically opens a new transaction, this would
> just roll back an empty transaction - not
On Sat, Aug 9, 2014 at 10:32 AM, Chris Kaynor wrote:
> The main issue I can see with that idea is that the exception will keep a
> reference to the database connection (as with all locals), so unless you
> explicitly close it within a finally clause, the database connection could
> still be left h
On Sat, Aug 9, 2014 at 9:55 AM, Chris Kaynor wrote:
> try:
> action
> commit
> finally:
> rollback
If commit/rollback automatically opens a new transaction, this would
just roll back an empty transaction - not a big deal. But yes, I do
see what you're looking at here.
However, struct
On Sat, Aug 9, 2014 at 8:01 AM, Chris Kaynor wrote:
> However, I'd recommend re-raising the exception after rolling back the
> transaction with a bare "raise" statement right after the db.rollback() - at
> the absolute minimum, you should log the error. This will likely let you see
> what your pro
On Fri, Aug 8, 2014 at 12:07 PM, Matt Smith wrote:
> I am trying to write a program that will loop through a text file and
> delete rows in a mysql database.
>
> It seemingly runs but I don't see anything getting deleted in the db.
> Is there anything apparent that I am missing?
>
> This is the
On Sat, Aug 9, 2014 at 5:07 AM, Matt Smith wrote:
> # Prepare SQL query to DELETE required records
> sql = "DELETE FROM tblc_users WHERE user_email=%s, % (line)"
> try:
> # Execute the SQL command
> cursor.execute(sql)
> # Commit your changes i
On 08/08/2014 20:07, Matt Smith wrote:
I am trying to write a program that will loop through a text file and
delete rows in a mysql database.
It seemingly runs but I don't see anything getting deleted in the db.
Is there anything apparent that I am missing?
This is the code:
#!/usr/bin/python
i
On Fri, Aug 8, 2014 at 3:07 PM, Matt Smith wrote:
> I am trying to write a program that will loop through a text file and delete
> rows in a mysql database.
>
> It seemingly runs but I don't see anything getting deleted in the db.
> Is there anything apparent that I am missing?
>
> This is the cod
I am trying to write a program that will loop through a text file and
delete rows in a mysql database.
It seemingly runs but I don't see anything getting deleted in the db.
Is there anything apparent that I am missing?
This is the code:
#!/usr/bin/python
import mysql.connector
#
f=open('/home/smi
12 matches
Mail list logo