Subham9126 commited on
Commit
0c90277
Β·
verified Β·
1 Parent(s): 3fd3eea

Upload 10 files

Browse files
Files changed (2) hide show
  1. refresh_sources.py +24 -5
  2. sources.yaml +1 -14
refresh_sources.py CHANGED
@@ -22,13 +22,32 @@ CH_URL = "http://127.0.0.1:8123"
22
 
23
  def run_subprocess(cmd, cwd=None, env=None):
24
  try:
25
- result = subprocess.run(
 
 
26
  cmd, cwd=cwd, env=env,
27
- capture_output=True, text=True, check=True
28
  )
29
- return result.stdout.strip(), True
30
- except subprocess.CalledProcessError as e:
31
- return e.output.strip() + "\n" + e.stderr.strip(), False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
 
34
  def execute_clickhouse_query(sql):
 
22
 
23
  def run_subprocess(cmd, cwd=None, env=None):
24
  try:
25
+ # We use Popen to stream stderr to the console for progress bars
26
+ # while still capturing stdout for return values if needed.
27
+ process = subprocess.Popen(
28
  cmd, cwd=cwd, env=env,
29
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
30
  )
31
+
32
+ # Stream stderr in real time
33
+ stderr_output = []
34
+ while True:
35
+ line = process.stderr.readline()
36
+ if not line and process.poll() is not None:
37
+ break
38
+ if line:
39
+ sys.stderr.write(line)
40
+ sys.stderr.flush()
41
+ stderr_output.append(line)
42
+
43
+ stdout, _ = process.communicate()
44
+
45
+ if process.returncode == 0:
46
+ return stdout.strip(), True
47
+ else:
48
+ return "".join(stderr_output).strip(), False
49
+ except Exception as e:
50
+ return str(e), False
51
 
52
 
53
  def execute_clickhouse_query(sql):
sources.yaml CHANGED
@@ -28,20 +28,7 @@ sources:
28
  - view_name: hf_ohlc
29
  file_glob: "**/*.parquet"
30
  format: Parquet
31
- description: "Full OHLCV data from HF dataset"
32
- # columns: # explicit column list for the VIEW
33
- # - timestamp
34
- # - symbol
35
- # - isin
36
- # - series
37
- # - open
38
- # - high
39
- # - low
40
- # - close
41
- # - volume
42
- # - interval_minutes
43
- # - segment
44
- # - exchange
45
 
46
  # ── EXAMPLE: Adding a second data source ──────────────────────────────
47
  # Just uncomment and edit:
 
28
  - view_name: hf_ohlc
29
  file_glob: "**/*.parquet"
30
  format: Parquet
31
+ description: "Full OHLCV data from HF dataset, selects all 150+ columns automatically"
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  # ── EXAMPLE: Adding a second data source ──────────────────────────────
34
  # Just uncomment and edit: