Getting examples: sequences of SQL statements

To create examples of real sequences of SQL statements we can use a django command that replaces runserver. This way we are able to see for example what happens when a user creates a milestone on Basie:

SELECT django_session.session_key, django_session.session_data, django_session.expire_date FROM django_session WHERE (django_session.session_key = 6c8039fc8f68a6bd34f130e6c59660cc  AND django_session.expire_date > 2010-02-09 16:45:50.814329 )

SELECT auth_user.id, auth_user.username, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.is_staff, auth_user.is_active, auth_user.is_superuser, auth_user.last_login, auth_user.date_joined FROM auth_user WHERE auth_user.id = 1

SELECT a3c_userprofile.id, a3c_userprofile.user_id, a3c_userprofile.status, a3c_userprofile.language, a3c_userprofile.timezone FROM a3c_userprofile WHERE a3c_userprofile.user_id = 1

SELECT a3c_project.id, a3c_project.name, a3c_project.tagline, a3c_project.description, a3c_project.slug, a3c_project.locked, a3c_project.default_group_id, a3c_project.anonymous_group_id, a3c_project.homepage_id, a3c_project.channel_id FROM a3c_project WHERE a3c_project.slug = basie

SELECT a3c_project.id, a3c_project.name, a3c_project.tagline, a3c_project.description, a3c_project.slug, a3c_project.locked, a3c_project.default_group_id, a3c_project.anonymous_group_id, a3c_project.homepage_id, a3c_project.channel_id FROM a3c_project WHERE a3c_project.id = 1

SELECT (1) AS a FROM milestones_milestone WHERE (milestones_milestone.project_id = 1  AND milestones_milestone.name = Create different notations )

INSERT INTO milestones_milestone (name, project_id, due_date, description) VALUES (Create different notations, 1, 2010-02-28, )

SELECT django_content_type.id, django_content_type.name, django_content_type.app_label, django_content_type.model FROM django_content_type WHERE (django_content_type.model = milestone  AND django_content_type.app_label = milestones ) ORDER BY django_content_type.name ASC

INSERT INTO audit_genericauditmodel (audit_instance_name, audit_timestamp, audit_user_id, audit_project_id, audit_change_type, audit_object_id, audit_content_type_id) VALUES (Create different notations, 2010-02-09 16:45:50.873381, 1, 1, C, 1, 29)

INSERT INTO milestones_milestone_audit (genericauditmodel_ptr_id, name, project_id, due_date, description, id) VALUES (2, Create different notations, 1, 2010-02-28, , 1)

5 responses to this post.

  1. http://www.djangosnippets.org/snippets/159/

    More than one way to do it and more than one person interested in this kind of information about their django sites.

    Responder

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: