Skip to content

Instantly share code, notes, and snippets.

@nicobrenner
Created February 28, 2024 06:03
Show Gist options
  • Save nicobrenner/f8da15c99c45c229c03c89dae1ed94d6 to your computer and use it in GitHub Desktop.
Save nicobrenner/f8da15c99c45c229c03c89dae1ed94d6 to your computer and use it in GitHub Desktop.
SQLite query to get filtered job listings according to json data stored in a table
-- SQLite
-- Sometimes the json output from GPT is not valid
-- -> This query excludes invalid JSONs (about 1 in 150 for the data tested)
SELECT gi.job_id,
json_extract(gi.answer, '$.fit_for_resume') AS fit_for_resume,
json_extract(gi.answer, '$.company_name') AS company_name,
json_extract(gi.answer, '$.how_to_apply') AS how_to_apply,
json_extract(gi.answer, '$.fit_justification') AS fit_justification,
json_extract(gi.answer, '$.available_positions') AS available_positions,
json_extract(gi.answer, '$.remote_positions') AS remote_positions,
json_extract(gi.answer, '$.hiring_in_us') AS hiring_in_us,
jl.original_text
FROM gpt_interactions gi, job_listings jl
WHERE gi.job_id=jl.id AND json_valid(gi.answer) = 1 AND fit_for_resume='Yes' AND remote_positions='Yes' AND hiring_in_us<>'No'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment