Oct 25
Jim's comments on last week's work have been posted.
The next assignment (ORM, REST concepts, starting PHP) is posted.
We went over some python class (i.e. object) syntax.
I've attached an example.
ORM wrap-up
A little bit more experimentation with SqlSoup and Planet Express.
How can we set up object relations between Shipments and
Clients?
- What sort of relation is this?
- What kinds of methods would we like to have
- What does this look like in SqlSoup?
First step :
Package.relate('shipment', Shipment, backref=backref("packages"))
However, the Package to Client relationship is tricker, because there are *two* of those foreign keys.
Package.relate('sender', Client,
primaryjoin=Package.sender_id==Client.account_number,
backref=backref("packages_sent"))
The shipment to client relationship is similar.
Shipment.relate('senders', Client,
secondary=Package._table,
secondaryjoin=Package.sender_id==Client.account_number,
backref=backref("shipments_sent"))
Write some code to try these out and see how the objects work.
REST
PHP etc
Describe what it is; show some examples.
PHP likes MySQL, which is on csmarlboro.org.
Readings :
TODO in class:
- install a PHP application (e.g. WordPress) on csmarlboro, and set it up.
- command line tools
- wget or curl - downloading stuff
- "tar zxf" to unpack *.tar.gz or *.tgz archives
- chmod, chown : privileges!