Skip to content

Instantly share code, notes, and snippets.

@sohan
Last active August 29, 2015 14:04
Show Gist options
  • Save sohan/94d448243957442f878d to your computer and use it in GitHub Desktop.
Save sohan/94d448243957442f878d to your computer and use it in GitHub Desktop.
Install cURL UDL Source on Vertica
#!/bin/sh
# Run on a vertica node. Every node needs curl at least cURL installed
# Install curl and gcc
sudo yum install -y gcc-c++
sudo yum install -y curl
sudo yum install -y libcurl-devel
# `make` will fail on some libs that require Java, but will build the cURL source
cd /opt/vertica/sdk/examples && make
/*
* Create a library for cURL and add it as a UDL source.
* Run these commands from vsql or equivalent
*/
CREATE LIBRARY curllib as '/opt/vertica/sdk/examples/build/cURLLib.so'
CREATE SOURCE curl AS LANGUAGE 'C++' NAME 'CurlSourceFactory' LIBRARY curllib
/*
* An example of how to use your shiny new curl UDL Source.
*/
CREATE TABLE IF NOT EXISTS rankings (
pageURL VARCHAR(300),
pageRank INT,
avgDuration INT
)
COPY rankings WITH SOURCE curl(url='http://big-data-benchmark.s3.amazonaws.com/pavlo/text/tiny/rankings/part-00000') DELIMITER ','
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment