From 8b3417a74f58082be6701b5f9648ba769ce2d2dc Mon Sep 17 00:00:00 2001
From: Quentin Codelupi <quentin.codelupi@cern.ch>
Date: Tue, 23 Jul 2019 16:59:04 +0200
Subject: [PATCH] Final Init

---
 .gitignore       |  2 ++
 README.md        | 14 ++++++++++++++
 property-pull.py | 23 ++++++++++++-----------
 3 files changed, 28 insertions(+), 11 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..db08384
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+
+pyconf.py
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0e95fc8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,14 @@
+# Property Pull
+
+Property pull is a Python project for the Cern's BLM section.
+It get precise data property for diamond devices by NXCALS and store it in lighter format on a MYSQL DB.
+In order to be used in other application.
+
+## Installation 
+
+
+## Usage
+
+
+## Left to do
+
diff --git a/property-pull.py b/property-pull.py
index 9185411..c4eb892 100644
--- a/property-pull.py
+++ b/property-pull.py
@@ -2,6 +2,7 @@ import json
 import sys
 
 import mysql.connector
+import pyconf as cfg
 
 from cern.nxcals.pyquery.builders import *
 from pyspark import SparkConf
@@ -18,11 +19,11 @@ _dest_dir = '.'
 
 # mysqlDB variables
 mydb = mysql.connector.connect(
-    host='dbod-testdb-nxdblm.cern.ch',
-    port='5501',
-    user='pythonUser',
-    passwd='pythonPusher',
-    database='nxcals_blm_data'
+    host=cfg.mysql['host'],
+    port=cfg.mysql['port'],
+    user=cfg.mysql['user'],
+    passwd=cfg.mysql['passwd'],
+    database=cfg.mysql['database']
 )
 
 # id of the sql data's row for this filling
@@ -66,12 +67,12 @@ def pull_histogram(_start_time, _end_time, _device):
     data = {}
 
     df = KeyValuesQuery.builder(spark).system("CMW") \
-                   .startTime(_start_time) \
-                   .endTime(_end_time) \
-                   .entity() \
-                   .keyValue("device", _device) \
-                   .keyValue("property", _property) \
-                   .buildDataset()
+        .startTime(_start_time) \
+        .endTime(_end_time) \
+        .entity() \
+        .keyValue("device", _device) \
+        .keyValue("property", _property) \
+        .buildDataset()
 
     df.printSchema()
 
-- 
GitLab