Skip to content

Commit 3b2ef62

Browse files
authored
Run DB query as is (#1207)
* run db query as is and do not compile by sqlalchemy * revert test select * pass current env to callshell
1 parent a74d35c commit 3b2ef62

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

patchwork/steps/CallSQL/CallSQL.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def run(self) -> dict:
4646
try:
4747
rv = []
4848
with self.engine.begin() as conn:
49-
cursor = conn.execute(text(self.query))
49+
cursor = conn.exec_driver_sql(self.query)
5050
for row in cursor:
5151
result = row._asdict()
5252
rv.append(result)

patchwork/steps/CallShell/CallShell.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from __future__ import annotations
22

3+
import os
34
import shlex
45
import subprocess
56
from pathlib import Path
67

78
from patchwork.common.utils.utils import mustache_render
89
from patchwork.logger import logger
910
from patchwork.step import Step, StepStatus
11+
from patchwork.steps import CallSQL
1012
from patchwork.steps.CallShell.typed import CallShellInputs, CallShellOutputs
1113

1214

@@ -24,7 +26,7 @@ def __parse_env_text(env_text: str) -> dict[str, str]:
2426
env_spliter.whitespace_split = True
2527
env_spliter.whitespace += ";"
2628

27-
env: dict[str, str] = dict()
29+
env: dict[str, str] = os.environ.copy()
2830
for env_assign in env_spliter:
2931
env_assign_spliter = shlex.shlex(env_assign, posix=True)
3032
env_assign_spliter.whitespace_split = True

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "patchwork-cli"
3-
version = "0.0.92"
3+
version = "0.0.93"
44
description = ""
55
authors = ["patched.codes"]
66
license = "AGPL"

0 commit comments

Comments
 (0)