More Query

4 views
Skip to first unread message

Luca Verardi

unread,
Jul 3, 2009, 9:10:31 AM7/3/09
to TurboGears
Hi i'm new in turbogears world,
I have a question for you,

When i load my page, and i see the runtime in a shell, turbogears show
me more time this query.

SELECT visit.visit_key AS visit_visit_key, visit.expiry AS
visit_expiry,
visit.created AS visit_created
FROM visit
WHERE visit.visit_key = %(visit_visit_key)s ORDER BY visit.visit_key
{'visit_visit_key': '423bdf8b81fd266e16ee31c7d0c9da5e79e43c7f'}
Retrieving identity for visit:
423bdf8b81fd266e16ee31c7d0c9da5e79e43c7f

Identity is available...
SELECT visit_identity.visit_key AS visit_identity_visit_key,
visit_identity.user_id AS visit_identity_user_id
FROM visit_identity
WHERE visit_identity.visit_key = %(visit_identity_visit_key)s ORDER
BY
visit_identity.visit_key
LIMIT 1

{'visit_identity_visit_key':
'423bdf8b81fd266e16ee31c7d0c9da5e79e43c7f'}
SELECT user.password AS user_password, user.logname AS user_logname,
anon_a2d6.codice AS anon_a2d6_codice, anon_a2d6.descrizione AS
anon_a2d6_descrizione, anon_a2d6.group_id AS anon_a2d6_group_id,
user.data_inizio AS user_data_inizio, user.data_fine AS
user_data_fine,
user.id AS user_id, user.id_anagrafica AS user_id_anagrafica,
anon_f3fb.tipo_persona AS anon_f3fb_tipo_persona, anon_f3fb.id AS
anon_f3fb_id, anon_f3fb.id_comune AS anon_f3fb_id_comune,
anon_f3fb.cod_professione AS anon_f3fb_cod_professione,
anon_f3fb.dato_fiscale AS anon_f3fb_dato_fiscale, anon_f3fb.localita
AS
anon_f3fb_localita, anon_f3fb.telefono AS anon_f3fb_telefono,
anon_f3fb.email AS anon_f3fb_email, anon_f3fb.nome AS anon_f3fb_nome,
anon_f3fb.tipo AS anon_f3fb_tipo, anon_f3fb.cod_titolo_studio AS
anon_f3fb_cod_titolo_studio, anon_f3fb.indirizzo AS
anon_f3fb_indirizzo,
anon_f3fb.id_precedente AS anon_f3fb_id_precedente,
anon_f3fb.cod_nazione_nascita AS anon_f3fb_cod_nazione_nascita,
anon_f3fb.cod_cittadinanza AS anon_f3fb_cod_cittadinanza,
anon_f3fb.id_comune_nascita AS anon_f3fb_id_comune_nascita,
anon_f3fb.stato_record AS anon_f3fb_stato_record, anon_f3fb.id_user
AS
anon_f3fb_id_user, anon_f3fb.cap AS anon_f3fb_cap,
anon_f3fb.ts_ultima_modifica AS anon_f3fb_ts_ultima_modifica,
anon_f3fb.data_nascita AS anon_f3fb_data_nascita
FROM user LEFT OUTER JOIN tg_group AS anon_e91a ON user.id =
anon_e91a.id_user LEFT OUTER JOIN role AS anon_a2d6 ON
anon_a2d6.codice
= anon_e91a.cod_role LEFT OUTER JOIN anagrafica AS anon_f3fb ON
anon_f3fb.id = user.id_anagrafica
WHERE user.id = %(user_id)s ORDER BY user.id, anon_e91a.id,
anon_f3fb.id

{'user_id': 1695}

i don't know if is a TG(1.0.3) problem or a SA problem (SA version
0.3)
but this behavior steal me much time.

Can you help me?
Thanks

Thank you very much for any help.



Florent Aide

unread,
Jul 3, 2009, 10:34:11 AM7/3/09
to turbo...@googlegroups.com
You have an option in your config file about sqlalchemy.echo=False
(and yours may be set to True) I don't remember the 1.0.3 version well
:)

If you are a new user starting with TurboGears I would encourage you
to use directly version 2.0.1 though.

Florent.

Luca Verardi

unread,
Jul 3, 2009, 11:04:48 AM7/3/09
to TurboGears
Thanks for the answer but i don't want hidden it but delete it.
I check my query with SA and i see that i don't write this more query
in my code.


On Jul 3, 4:34 pm, Florent Aide <florent.a...@gmail.com> wrote:
> You have an option in your config file about sqlalchemy.echo=False
> (and yours may be set to True) I don't remember the 1.0.3 version well
> :)
>
> If you are a new user starting with TurboGears I would encourage you
> to use directly version 2.0.1 though.
>
> Florent.
>

Glauco

unread,
Jul 6, 2009, 7:09:00 AM7/6/09
to turbo...@googlegroups.com
Luca Verardi ha scritto:

> Thanks for the answer but i don't want hidden it but delete it.
> I check my query with SA and i see that i don't write this more query
> in my code.
>

This is because your application has the identity facility enabled...
So every time you get from a controller decorated with @identity...
tg do all stuff for you.

see
http://docs.turbogears.org/1.0/Identity

Gla

Luca Verardi

unread,
Jul 6, 2009, 8:33:06 AM7/6/09
to TurboGears
I see your link but i didn't found any reference how to stop this
query's behaviour.
I want that TG take in memory the login and stop to ask the database
the credential for the autentications

jo

unread,
Jul 6, 2009, 8:57:44 AM7/6/09
to turbo...@googlegroups.com
Luca Verardi ha scritto:
> On Jul 6, 1:09 pm, Glauco <glauco....@prometeia.it> wrote:
>
>> Luca Verardi ha scritto:
>>
>>
>>> Thanks for the answer but i don't want hidden it but delete it.
>>> I check my query with SA and i see that i don't write this more query
>>> in my code.
>>>
>> This is because your application has the identity facility enabled...
>> So every time you get from a controller decorated with @identity...
>> tg do all stuff for you.
>>
>> seehttp://docs.turbogears.org/1.0/Identity
>>
>>
>
> I see your link but i didn't found any reference how to stop this
> query's behaviour.
> I want that TG takes in memory the login and stop to ask the database
> the credential for the autentications
>

Seems, TG executes the same query every time you try to access a
controller's function.
Perhaps, what you need is a way to configure identity to keep in mind
any authentication to decrease
database access.
For example if you access, is say, http://pippo/pluto
TG identity checks if you have the credentials to access pluto,
if so, you expect that TG saves in cache this authentication in such way
the next time you access: http://pippo/pluto, the credential is already
in cache and
TG avoid another access to DB.
I don't know if there's a way to configure identity in economy way.

j




> >
>


--
Jose Soares
Sferacarta Net
Via Bazzanese 69
40033 Casalecchio di Reno
Bologna - Italy
Ph +39051591054
fax +390516131537
web:www.sferacarta.com

Le informazioni contenute nella presente mail ed in ogni eventuale file allegato sono riservate e, comunque, destinate esclusivamente alla persona o ente sopraindicati, ai sensi del decreto legislativo 30 giugno 2003, n. 196. La diffusione, distribuzione e/o copiatura della mail trasmessa, da parte di qualsiasi soggetto diverso dal destinatario, sono vietate. La correttezza, l'integrità e la sicurezza della presente mail non possono essere garantite. Se avete ricevuto questa mail per errore, Vi preghiamo di contattarci immediatamente e di eliminarla. Grazie.

This communication is intended only for use by the addressee, pursuant to legislative decree 30 June 2003, n. 196. It may contain confidential or privileged information. You should not copy or use it to disclose its contents to any other person. Transmission cannot be guaranteed to be error-free, complete and secure. If you are not the intended recipient and receive this communication unintentionally, please inform us immediately and then delete this message from your system. Thank you.



Reply all
Reply to author
Forward
0 new messages