Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6288 > unrolled thread

Re: Newbie question about SQLite + Python and twitter

Started byPhilip Semanchuk <philip@semanchuk.com>
First post2011-05-25 21:08 -0400
Last post2011-05-26 09:29 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Newbie question about SQLite + Python and twitter Philip Semanchuk <philip@semanchuk.com> - 2011-05-25 21:08 -0400
    Re: Newbie question about SQLite + Python and twitter John Nagle <nagle@animats.com> - 2011-05-26 09:29 -0700

#6288 — Re: Newbie question about SQLite + Python and twitter

FromPhilip Semanchuk <philip@semanchuk.com>
Date2011-05-25 21:08 -0400
SubjectRe: Newbie question about SQLite + Python and twitter
Message-ID<mailman.2105.1306375393.9059.python-list@python.org>
On May 25, 2011, at 2:17 PM, Jayme Proni Filho wrote:

> Helo guys,
> 
> I'm building a local application for twitter for my brother's store. I'm in
> the beginning and I have some newbie problems, so:
> 
> I create a table called tb_messages with int auto increment and varchar(140)
> fields;
> I did three SQL funcionts, insert_tweet, delete_tweet, select_tweet
> 
> select_tweet is use for getting messages for sending them to twitter;
> 
> My problem is: How can i make my select_tweet works at the same time that
> insert or delete funcions. I just got to work when I stop select function.
> 
> I would like to do my app works all the time.

Hi Jayme,
You need to provide a lot more information for us to be able to help you. 

Some suggestions -- 
http://www.istf.com.br/perguntas/#beprecise



bye
Philip

[toc] | [next] | [standalone]


#6327

FromJohn Nagle <nagle@animats.com>
Date2011-05-26 09:29 -0700
Message-ID<4dde8006$0$2159$742ec2ed@news.sonic.net>
In reply to#6288
On 5/25/2011 6:08 PM, Philip Semanchuk wrote:
>
> On May 25, 2011, at 2:17 PM, Jayme Proni Filho wrote:
>
>> Helo guys,
>>
>> I'm building a local application for twitter for my brother's store. I'm in
>> the beginning and I have some newbie problems, so:
>>
>> I create a table called tb_messages with int auto increment and varchar(140)
>> fields;
>> I did three SQL funcionts, insert_tweet, delete_tweet, select_tweet
>>
>> select_tweet is use for getting messages for sending them to twitter;
>>
>> My problem is: How can i make my select_tweet works at the same time that
>> insert or delete funcions. I just got to work when I stop select function.
>>
>> I would like to do my app works all the time.
>
> Hi Jayme,
> You need to provide a lot more information for us to be able to help you.

    I suspect that the original poster's problem is that he's trying to
delete items from a table while reading the results from a SELECT on
the same table.  SQL systems don't allow that.  It has the same problem
as, in Python, deleting from a dict while iterating over it.

    One way to do this properly is something like

	loop
		START TRANSACTION
		SELECT itemid, item FROM tablename WITH ...  LIMIT 1
		get one item
		if no item, break
		do whatever needs to be done with item
		DELETE FROM tablename WHERE itemid = %s
		END TRANSACTION


    Also, it sounds like he's writing a spam program for Twitter.

					John Nagle

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web