class_docstr: Establishes a connection to the database and returns an open cursor.
  # Use as context manager
  with Cursor() as cur:
      cur.execute(query)
      ...
class_docstr_tok: ["Establishes","a","connection","to","the","database","and","returns","an","open","cursor",".","#","Use","as","context","manager","with","Cursor","(",")","as","cur",":","cur.execute","(","query",")","..."]
code: def __enter__(self):
      if self.dictionary:
          self.cursor = self.conn.cursor(cursor_factory=DictCursor)
      else:
          self.cursor = self.conn.cursor()
      return self.cursor
  
file_path: dejavu/dejavu/database_handler/postgres_database.py
imports: import queue
  import psycopg2
  from psycopg2.extras import DictCursor
  from dejavu.base_classes.common_database import CommonDatabase
  from dejavu.config.settings import FIELD_FILE_SHA1, FIELD_FINGERPRINTED, FIELD_HASH, FIELD_OFFSET, FIELD_SONG_ID, FIELD_SONGNAME, FIELD_TOTAL_HASHES, FINGERPRINTS_TABLENAME, SONGS_TABLENAME
label_desc: Use image node_id 3 for calling the Cursor obj's underlying member method code with example usage: obj.__enter__() and returns: self