Posted on May 13, 2008 by michaelangela
This makes some interesting things possible. And it makes sense just looking at it. That’s even better.
Announcing django-sphinx 2.0.0 Full-text Search | David Cramer’s Blog
One of my tasks lately has been updating the django-sphinx
library to work with Sphinx 0.98, as it includes GIS components which
we have been wanting to possibly utilize [...]
Filed under: cool, django, orm, search, tool | No Comments »
Posted on May 7, 2008 by michaelangela
So you get the dreaded illegal mix of collations:
Pythoneer » Convert MySQL table to utf8
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
What do you do? Not too bad fortunately. And if you’re working with Django, it’s a little bit easier. Launch the shell with python manage.py shell. Then in the shell do something like [...]
Filed under: cool, django, orm, python, snippet, tip, tool | No Comments »
Posted on May 7, 2008 by michaelangela
Just making a note…
Extending Django’s database API to include full-text search (Mercurytide)
Filed under: api, django, orm, tip | No Comments »
Posted on April 24, 2008 by michaelangela
Here is a good discussion on concatenating Django Querysets. Very helpful! It also introduced me to itertools. This leads to some other talk about itertools. Very interesting!
The jist though is like this:
How do you concatenate two querysets? - Django users | Google Groups
import itertoolsq1 = Model1.objects.all()q2 = Model2.objects.all()for thing in [...]
Filed under: dev, django, orm, tip | No Comments »
Posted on March 29, 2008 by michaelangela
I recently wrote about exporting a Django database to xml. As a courtesy, Massimo, creator of web2py, put together a great little example for web2py
exporting in XML - web2py Web Framework | Google Groups
def export_xml(rows):
idx=range(len(rows.colnames))
colnames=[item.replace('.','_') for item in rows.colnames]
records=[]
[...]
Filed under: cool, dev, education, one-liner, orm, web2py | No Comments »
Posted on March 20, 2008 by michaelangela
(Python) PyProgram #7 - Time Object Diffs « the minds of a tuxian
I had two time objects and needed to find the difference of time between them. Upon Googling, querying in #python and checking the documentation, found that there is not built-in function available for this. Though there were some cookbook recipes, I [...]
Filed under: dev, orm, python, storm | No Comments »
Posted on March 20, 2008 by michaelangela
OpenID as a WSGI filter, part 2 - Damian’s archive - Alleged Literature
Programmers learn through programming, and my research into OpenID has got as far as a web application that lets you do nothing at all except log in with OpenID. Along the way I have played a bit with Canonical’s own object-relational [...]
Filed under: dev, orm, python | No Comments »
Posted on March 18, 2008 by michaelangela
A full example, albeit with SQLObject, but the concept is pretty clear. With web2py, the form.validate would be followed with an explicit data insert. From the looks of the **form_result insert, form.validate returns a list of fields that can be directly inserted. The same format should be able to be used with Storm.
Handling Form data [...]
Filed under: dev, orm, python, web2py | No Comments »
Posted on March 13, 2008 by michaelangela
So I have a sample data set in a database created by web2py. After some experimentation I can access, modify and create data with Elixir/SQLAlchemy. Just some notes, like remember to encode web2py blobs with utf8 if you’re not going through web2py’s functions.
r=Recipe.query.all() r[0].instructions=u’some text to submit’.encode(’utf8′
cb.session.flush()
And then something happend before this got pulished [...]
Filed under: dev, elixir, orm, sqlalchemy, web2py | No Comments »
Posted on March 10, 2008 by michaelangela
Or “When not to use something that looks like it’s obviously going to make your life so much easier”
SQLAlchemy, Declarative layers, and the ORM ‘Problem’
On first glance, its pretty obvious that everyone should love Elixir vs the obviously more tedious SA approach of layout out your tables, then mapping them to the class [...]
Filed under: dev, elixir, orm, python, sqlalchemy | No Comments »