[PonyORM-list] Couple of questions

Goldberg, Arthur P arthur.p.goldberg at mssm.edu
Wed Jun 18 23:13:19 UTC 2014


Pony's nifty -- thanks.

Some questions:

1. Direct SQL. Suppose I want to drop a table. I thought that this would work because executescript() appears in examples
        sql = "DROP TABLE IF EXISTS %s;" % tableName
        db.get_connection().executescript(sql)

2. Entity class fields. Suppose I have

class Subject(db.Entity):
    FamilyID = Optional(str)
    IndivID = PrimaryKey(str)
    PatID = Optional(str, default='0')
    MatID = Optional(str, default='0')
    Sex = Required(str)
    Pheno = Required(int)
    SampleSet = Required(str)
    variants = Set(Variant)
className = 'Subject'
self.slqobj = globals()[ className ]
# I can get all fields in Subject with
self.slqobj._attrs_

but is there an official method?

Thanks
Arthur

---

Arthur Goldberg
Associate Professor of Psychiatry
Seaver Autism Center and Icahn Institute for Genomics & Multiscale Biology
Icahn School of Medicine at Mount Sinai
Seaver Center, Room ABE-33
212-241-4229
Arthur.Goldberg at mssm.edu<mailto:Arthur.Goldberg at mssm.edu>
Follow us on Twitter @IcahnInstitute<https://twitter.com/IcahnInstitute>




-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20140618/72a5dbed/attachment.html>


More information about the ponyorm-list mailing list