Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
PL/Python	
  
PostgreSQL	
  +	
  PostGIS	
  
phil.bar6e@s6r.ac.uk	
  
Crea6ng	
  Func6ons	
  in	
  PostgreSQL	
  
Other	
  than	
  SQL	
  and	
  C	
  PostgreSQL	
  allows	
  func6ons	
  to	
  ...
Workflow	
  
•  Set	
  up	
  PC	
  	
  
–  PostgreSQL	
  install	
  
–  Corresponding	
  Python	
  install	
  
	
  
•  Set	...
PL/Python	
  
•  plpython2u	
  
•  plpython3u	
  
Windows	
  	
  
	
  
PostgreSQL	
  9.3	
  is	
  compiled	
  against	
  P...
Installa6on	
  on	
  Ubuntu	
  
Add	
  plpython	
  to	
  exsi6ng	
  PostgreSQL	
  install	
  
	
  
	
  
	
  	
  	
  	
  	
...
Adding	
  extension	
  to	
  a	
  DB	
  
Create	
  DB
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
Upcoming SlideShare
Loading in …5
×

Phil Bartie QGIS PLPython

519 views

Published on

Phil Bartie's presentation on using PL Python in PostgreSQL given at the 3rd QGIS user group meeting in Edinburgh on 5th May 2015

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Phil Bartie QGIS PLPython

  1. 1. PL/Python   PostgreSQL  +  PostGIS   phil.bar6e@s6r.ac.uk  
  2. 2. Crea6ng  Func6ons  in  PostgreSQL   Other  than  SQL  and  C  PostgreSQL  allows  func6ons  to   be  wriBen  in:     •  PL/pgSQL  –  SQL  procedural  language   •  PL/Tcl  –  Tcl  Procedural  language   •  PL/Perl  –  Perl  Procedural  language   •  PL/Python  –  Python  procedural  language              +  addi&onal    (eg  R,  Ruby,  Java,  PHP,  Unix  shell)   h+p://www.postgresql.org/docs/9.3/sta&c/xplang.html   standard  
  3. 3. Workflow   •  Set  up  PC     –  PostgreSQL  install   –  Corresponding  Python  install     •  Set  up  DB     –  Create  database   –  Add  the  PL/Python  extension  (create  extension)   •  Create  Func6on   •  Use  Func6on  
  4. 4. PL/Python   •  plpython2u   •  plpython3u   Windows       PostgreSQL  9.3  is  compiled  against  Python  3.2     PostgreSQL  9.4  is  compiled  against  Python  3.3     pg  428   untrusted  language  =    can  access  file  system  of  OS   •  Check  matching  versions  of  PostgreSQL  distribu&on   and  Python  (inc  32bit  vs  64  bit)   •  Install  modules  for  correct  Python  version  
  5. 5. Installa6on  on  Ubuntu   Add  plpython  to  exsi6ng  PostgreSQL  install                sudo apt-get install postgresql-plpython-9.3
  6. 6. Adding  extension  to  a  DB   Create  DB

×