sql: count is robust to failing primary key

If The SQLAlchemy .primary_key attribute is missing its
.columns attribute starts returning [].  This stateful change causes
problems in try-except code blocks as occurs in count on selections.

This change works around this issue in Blaze.  We should probably
report up to SQLAlchemy as well.
Merge pull request #877 from mrocklin/sql-join-count

sql: count is robust to failing primary key