Skip to content

Instantly share code, notes, and snippets.

@fabriziomello
Created March 27, 2019 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabriziomello/8cbea8bd2e618d24c9b5412fab3b696a to your computer and use it in GitHub Desktop.
Save fabriziomello/8cbea8bd2e618d24c9b5412fab3b696a to your computer and use it in GitHub Desktop.
CREATE OR REPLACE FUNCTION bytea_import(filename text) RETURNS bytea AS
$$
import os
with open(filename, 'r') as f:
s = f.read()
return s
$$
LANGUAGE 'plpythonu' VOLATILE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment