Skip to content

Instantly share code, notes, and snippets.

@gusreyes01
Last active August 4, 2018 18:20
Show Gist options
  • Save gusreyes01/03b48f5f14e7077a9cd61fffa63fb14b to your computer and use it in GitHub Desktop.
Save gusreyes01/03b48f5f14e7077a9cd61fffa63fb14b to your computer and use it in GitHub Desktop.
from myproject import settings
dbHost = settings.DATABASES['default']['HOST']
dbUsername = settings.DATABASES['default']['USER']
dbPassword = settings.DATABASES['default']['PASSWORD']
dbName = settings.DATABASES['default']['NAME']
def call_pgsl_function(function_name, arg):
conn = psycopg2.connect(
"dbname={} user={} password={} host={}”.format(dbName, dbUsername, dbPassowrd, dbHost)
cur = conn.cursor()
cur.callproc(function_name, arg)
result_set = cur.fetchall()
try:
for x in result_set:
return x
except Exception as e:
print(“Something went wrong [{}]”.format(str(e))
finally:
if cur is not None:
cur.close()
def match_function_skills_job(profile_id):
try:
res = call_pgsl_function('match_function_skills_job', [profile_id])
return res
except:
return 0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment