예제 #1
0
from pydwms.runner import MysqlRunner

runner = MysqlRunner('dw_master')

sqls = '''
DELETE FROM dw_db.dm_dwms_server WHERE cal_dt = ${startDate};
INSERT INTO dw_db.dm_dwms_server
SELECT
  ${startDate},
  server_type,
  COUNT(*)
FROM dw_db.dw_dwms_server
GROUP BY server_type;
'''

runner.summary(sqls)
예제 #2
0
from pydwms.runner import MysqlRunner

runner = MysqlRunner('dw_master')

sqls = '''
TRUNCATE TABLE dw_extract.ds_dwms_server;
LOAD DATA INFILE ${dataFile} INTO TABLE dw_extract.ds_dwms_server
CHARACTER SET utf8
(
  id,
  server_name,
  server_type
);

TRUNCATE TABLE dw_db.dw_dwms_server;
INSERT INTO dw_db.dw_dwms_server
SELECT
  id,
  server_type
FROM dw_extract.ds_dwms_server;
'''

runner.load(sqls, 'dwms_server');