Archive for the ‘Pylons’ Category

Filed Under (Django, Pylons, SqlAlchemy) by Marcin Kuźmiński on September-26-2009

Recently i had to create a lot of models using declarative mode with sqlalchemy 0.5.5 It was very time consuming especially for large databases. I started to think about an automated solution.

Sqlalchemy have this auto load feature which fetches info about tables by itself. I wanted to use this somehow to generate a string which can be easily  copy/paste to database model definition script. So i started a little project to write auto  model generator for sql alchemy based on auto load feature in sqlalchemy.

The script  is not perfect but it works and save a huge amount of time just codding the models. In fact is was able to setup a 186 table database model in 15minutes with this script.

Well the script helped me a lot and now on when i have to load some new existing database or changes i use it all the time.

The documentation is inside the script i tried to write it so anybody could use it out of the box.

I tested it on 4 schema 200+ tables database and i worked quite good. This script still have to be polished but current functionality is enough for most users.

My script is going to be also a part of django-alchemy project started by my friend Lukasz Balcerzak. You can visit the project site @ http://code.google.com/p/django-alchemy/

I used it with Pylons application and Django with modded sqlalchemy. but it can be basically used in any app which uses sqlalchemy. I did not test it with mysql though,but it should work, just specify mysql as dialect.

You can download this script from sqlalchemy model generator



Filed Under (Pylons) by Marcin Kuźmiński on July-30-2009

In python a nice function divmod does the trick.

For example:

def sec2min(sec):
    return divmod(sec,60)

now sec2min(181) outputs (3,1) 3minutes and 1 seconds ,you can obtain hours,days etc using divmod :)



Filed Under (Nginx, Pylons, Python) by Marcin Kuźmiński on June-19-2009

Hi welcome to python blog !

We are up and running. Some technical information about our site:

  • Nginx 0.7.59
  • SliceHost 256MB slice
  • PHP 5.2.9 patched with php-fpm
  • Debian 5.0 + grsec & selinux
  • Python 2.6.2

Soon I’ll post the setups i made for this site as well as some useful links for custom building php with php-fm .

Regards Marcin Kuzminski site Administrator