cleaned up sqlalchemy improvements after rebase

Made a mistake and didn't git rebase --continue with the detached head, but the LRU cache and actual bulk trait insert improvements are Andrew Melton's. My changes were to get it working with a rebase by exploding the cache get/set to the two _get_or_create methods, adding a compound key for TraitType, and resolving the classmethod vs. instance method issues, since we need to utilize the cache now.