Hi everyone!

I am newbie in Pylons, SqlAlchemy and Elixir.

- please tell me what is the best practice in connecting Pylons,
SqlAlchemy and Elixir?

I created two models - sxc_entity.py and sxc_image.py

- where to put create_all() function?
- how to connect model classes: SxcEntity and SxcImage with any
controller?


#sxc_entity.py

# -*- coding: utf-8 -*-
from elixir import *
from datetime import datetime

class SxcEntity(Entity):
    has_field('eid', Integer, primary_key=True)
    has_field('email', Unicode(255), unique=True)
    has_field('password', Unicode(20))
    has_field('name', Unicode(255))
    has_field('site', Unicode(255))
    has_field('state', Unicode(255))
    has_field('description', Unicode)
    has_field('logo', Unicode(255))
    has_many('images', of_kind='SxcImage')
    using_options(tablename='entity')


#sxc_image.py

# -*- coding: utf-8 -*-
from elixir import *

class SxcImage(Entity):
    has_field('iid', Integer, primary_key=True)
    has_field('name', Unicode(255))
    belongs_to('entities', of_kind='SxcEntity')
    using_options(tablename='image')

Thank you for any help.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to