Implement db get_[un]associated_nodes

These method were just stubs.
This patch implements them in db/sqlalchemy/api.py, and a subsequent
patch will expose this functionality via the API.

Change-Id: Iae68cbe3bf4e84a0f47a0770695bed9dae78aa95
Merge "Implement db get_[un]associated_nodes"