legacy: fix for run_sql import in bibrecord

* Addresses issue with imports outside application context.
  (closes #2295)

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>