code: def data_sql(db, sql):
      
      if not db:
          if sql:
              print "ERR: -db option must be set if using -sql"
          return ""
  
      cmd = """
      library(RPostgreSQL)
      drv = dbDriver('PostgreSQL')
      con = dbConnect(drv, dbname='%(db_name)s')
      q = "%(query)s"
      data = dbGetQuery(con, q)
      """
  
      return GGData(cmd % {
          'db_name': db,
          'query': sql
      })
docs: Load file using RPostgreSQL
  
      Place to edit if want to add more database backend support