Once again thanks for the helpful guidance Melvyn and Babatunde.

Babatunde: I will go through the links you provided and come back with new
queries.

Melvyn : Ya, I am a newbie in Django but have Web Development exp. There is
one problem when I wish to create models and queryset for connecting to the
database and that is like this,

1. My settings.py points to Postgres database, which is my main database.
2. The data I wish to extract and display in CSV, is in another database
(mysql). What I have come to know after completing the basic tutorials of
Django is that we define the database in the settings.py and since I
already have the postgres defined, how can I also connect to this MySql
Database, using views/models? This is why I wanted to trigger an external
py script which will deal with this MySql database separately.

Is there a way to connect to multiple databases simultaneously? If so then
please let me know how?

Thanks,
Smaran

On Sat, Jul 7, 2012 at 4:01 AM, Melvyn Sopacua <m.r.sopa...@gmail.com>wrote:

> On 7-7-2012 11:44, Smaran Harihar wrote:
> > Thanks for the reply Melvyn and Babatunde. So my script is, using the
> > parameters, to search in a database and then spitting out the output back
> > as CSV.
>
> This only makes sense in the django world, if your script is accessing a
> database that is not part of the application itself. For example an
> accounting program in django that replaces a firms older software.
> Access to previous years is then provided via a script that simply
> provides CSV format so data can be entered into a spreadsheet program
> and reports can be created. One would use this approach if converting
> the old data to the new application consumes too many resources for the
> few times the data will be used.
>
> I can't think of many other cases where I would use this approach, so ...
>
> > Ok, so adding it to view makes more sense, but how do i connect or
> execute
> > that view, on the click of the submit button??
>
> The key question is if you have models for the tables in this database?
> If so your best option is to translate the parameters to django's
> queryset syntax. If you don't understand what that means, you're
> probably new to django and we'll try to be more verbose.
>
> As a side note, especially when new to django but not unfamiliar with
> webdevelopment/databases, you need to learn to let go of your SQL
> knowledge and start thinking in models and querysets. Once you fully
> understand how this works and what you can do with it, you can apply
> your SQL knowledge to optimize what django's syncdb has created for you
> or even start working the other way around using inspectdb.
> --
> Melvyn Sopacua
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Thanks & Regards
Smaran Harihar

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to