芝尾幸一郎(@shibacow)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function odbc_test(){ | |
$DSN='IMPALA-SERVER'; | |
$USER=''; | |
$PASS=''; | |
$con=odbc_connect($DSN,$USER,$PASS); | |
if($con){ | |
$sql='select count(*) from sample_07'; | |
$rs = odbc_exec($con,$sql); | |
while($row = odbc_fetch_array($rs)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
import pyodbc | |
def main(): | |
con=pyodbc.connect('DSN=IMPALA-SERVER;UID=;PWD=;Database=Default;') | |
cursor=con.cursor() | |
sql='select count(*) from sample_07' | |
cursor.execute(sql) | |
for r in cursor.fetchall(): | |
print r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ODBC Data Sources] | |
;IMPALA-SERVER=Hive ODBC Driver | |
IMPALA-SERVER=Hive Driver | |
[IMPALA-SERVER] | |
Driver=/usr/lib/libhiveodbc.so.1 | |
Description=Hive ODBC Driver | |
;specify your impalad server | |
Host=192.168.1.6 | |
Port=21000 | |
Database= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ODBC Drivers] | |
Hive Driver=Installed | |
[Hive Driver] | |
Driver=/usr/lib/libhiveodbc.so.1 | |
Description=Hive Driver | |
Setup=/usr/lib/libhiveodbc.so.1 | |
APILevel=2 | |
ConnectFunctions=YYY | |
DriverODBCVer=1.0 | |
FileUsage=0 |
#ニコニコデータセット分析(構築偏) 芝尾幸一郎(@shibacow) #構築手順
- ニコニコ動画データセット取得
- コメントデータセットにsmidとファイル名を追記する
- S3へのデータアップロード
- AmazonEMRにデータを入れる
- 使いやすいようにデータをコンバート
#詳しくはこちら
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
from impala.dbapi import connect | |
import gevent | |
from impala.error import * | |
import time | |
def fetch(sql,func): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
import numpy as np | |
import doctest | |
def gini_coefficient(src): | |
""" | |
>>> gini_coefficient([245,362,826]) | |
0.40544312630844381 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule VercheckEx do | |
# requireで使用するライブラリを指定 | |
require HTTPoison | |
require Floki | |
require Timex | |
use Timex | |
def fetch_content(url, type) do | |
ret = HTTPoison.get!( url ) # urlで指定されるページのデータを取得 | |
%HTTPoison.Response{status_code: 200, body: body} = ret | |
# HTML bodyを取得する |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule VercheckEx do | |
# requireで使用するライブラリを指定 | |
require HTTPoison | |
require Floki | |
require Timex | |
use Timex | |
def fetch_content() do | |
IO.puts("fetch_content") | |
receive do | |
{caller,url,type,i} -> |
OlderNewer