GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feldera/python/felderize/felderize/feldera_client.py at main · feldera/feldera

Expand file tree

/

feldera_client.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
63 lines (48 loc) · 2.04 KB
/

feldera_client.py

Copy path

File metadata and controls

63 lines (48 loc) · 2.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from __future__ import annotations
import subprocess
import tempfile
from pathlib import Path
from felderize.constants import COMPILER_TIMEOUT
def _compiler_cmd(compiler: Path) -> list[str]:
"""Return the command prefix for invoking the compiler."""
if compiler.suffix == ".jar":
return ["java", "-jar", str(compiler)]
return [str(compiler)]
def validate_sql(sql: str, compiler_path: str | Path | None = None) -> list[str]:
"""Validate SQL using the local sql-to-dbsp compiler. Returns compiler errors."""
if not compiler_path:
return ["Compiler not found: set FELDERA_COMPILER in .env or use --compiler"]
compiler = Path(compiler_path)
if not compiler.is_file():
return [f"Compiler not found at {compiler}"]
cmd_prefix = _compiler_cmd(compiler)
with tempfile.NamedTemporaryFile(mode="w", suffix=".sql") as f:
f.write(sql)
f.flush()
try:
result = subprocess.run(
cmd_prefix + ["-i", "--ignoreOrder", "--alltables", "--noRust", f.name],
capture_output=True,
text=True,
timeout=COMPILER_TIMEOUT,
)
except subprocess.TimeoutExpired:
return [f"Compilation timed out after {COMPILER_TIMEOUT}s"]
except FileNotFoundError:
if compiler.suffix == ".jar":
return ["java not found — install Java 19+ to use the compiler JAR"]
return [f"Compiler not found at {compiler}"]
if result.returncode == 0:
return []
# Parse errors from stderr, stripping temp file paths for readability
stderr = result.stderr.replace(f.name, "<input>")
errors: list[str] = []
for line in stderr.strip().split("\n"):
line = line.strip()
if line.startswith("<input>:") or "error:" in line.lower():
errors.append(line)
if not errors and stderr.strip():
errors.append(stderr.strip())
return (
errors if errors else [f"Compilation failed with exit code {result.returncode}"]
)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.