Skip to main content


Showing posts from April, 2014

PyCon Notes: Introduction to SQLAlchemy

At PyCon, Mike Bayer , the author of SQLAlchemy, gave a three hour tutorial on it. Here's the video . What follows are my notes. He used something called sliderepl. sliderepl is a nice ASCII tool that's a mix of slides and a REPL. You can flip through his source code / slides in the terminal. It's actually pretty neat. At the lowest level, SQLAlchemy sends strings to the database and interprets the responses. It took him 10 years to write it. He started the project in 2005. He's finally going to hit 1.0. SQLAlchemy forces you to be aware of transactions. Isolation models have to do with how ongoing transactions see ongoing work amongst each other. Goals:     Provide helpers, etc.     Provides a fully featured facade over the Python DBAPI.     Provide an industrial strength, but optional, ORM.     Act as a base for inhouse tools. Philosophies:     Make the usage of different DBs and adaptors as consistent as possible.     But still expose uniqu

PyCon Notes: PostgreSQL Proficiency for Python People

In summary, this tutorial was fantastic! I learned more in three hours than I would have learned if I had read a whole book! Here's the video . Here are the slides . Here are my notes: Christophe Pettus was the speaker. He's from PostgreSQL Experts. PostgreSQL is a rich environment. It's fully ACID compliant. It has the richest set of features of any modern, production RDMS. It has even more features than Oracle. PostgreSQL focuses on quality, security, and spec compliance. It's capable of very high performance: tens of thousands of transactions per second, petabyte-sized data sets, etc. To install it, just use your package management system (apt, yum, etc.). Those systems will usually take care of initialization. There are many options for OS X. Heroku even built a that runs more like a foreground app. A "cluster" is a single PostgreSQL server (which can manage multiple databases). initdb creates the basic file structure.

Dagger: A Dependency Injection Framework for Android and Java

Dagger is a new dependency injection framework for Android and Java. I went to a meetup yesterday to learn more about it. These are my notes: The talk was by Jake Wharton who works at Square. Every single app has some form of DI. You can do DI even if you're not using a library for doing it. The goal of DI is to separate the behavior of something from its required classes. If you've ever used a constructor to receive stuff, you've done a simple version of DI. Square used Guice heavily. Problems with Guice: Config problems fail at runtime.  Slow initialization, slow injection, and memory problems. These are worse on Android. It causes the OS to load all the code for your app at once. This caused their app to take 2 seconds to start. They called Dagger "Object Graph" initially. Goals of Dagger: Static analysis of all dependencies and injections.  Fail as early as possible--compile time, not runtime. Eliminate the need to do reflection of