[Python Edinburgh] using django to create db for app?
alex at alexbird.co.uk
Thu Jan 26 11:16:24 CET 2012
On 26 January 2012 02:57, Philip Hunt <cabalamat at gmail.com> wrote:
> That's eminently doable: you use Django's ORM to define the database
> and then the admin interface to populate it.
> This then produces an sqlite file which (I presume but haven't
checked) is portable between sqlite installations.
It seems to work fine. As long as you have the same major version of
sqlite, I suspect.
At the moment the admin is just a nice bonus for checking the data. I may
get around to splitting the database and adding some meta-admin for
managing imports and snapshots.
I also thought it could be nice for prototyping tricky queries. By default
though, django doesn't really expose you to the SQL, because it's
introspecting and building queries on the fly, and extracting it is
discouraged for this reason. I don't think it will cause problems in this
case, but that does make it harder to find information about doing it.
> If your database is small you may want to just use a flat ascii file,
> or python data statements like this:
> data = [
> ["Fred Blogs", "123 Acacia Avenue", "EH12 1RS"],
> ...etc... ]
> which can then very easily be transformed into whatever data format you
The data is quite big, and comes from a variety of sources. The other
attraction of python though is that I spent years scraping data with python
(helped build skyscanner's current system) so, while I'm quite rusty, this
bit I'm happy with :o)
The bit I'm least sure about is delving into django to examine the model
and generate code from it. For example, I need to know the actual column
name as well as the name in the model. But It's probably easier than I
Sent from my fur lined mountain lair
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Edinburgh