Skip to content

Commit

Permalink
Run DB query as is (#1207)
Browse files Browse the repository at this point in the history
* run db query as is and do not compile by sqlalchemy

* revert test select

* pass current env to callshell
  • Loading branch information
CTY-git authored Jan 21, 2025
1 parent a74d35c commit 3b2ef62
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion patchwork/steps/CallSQL/CallSQL.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def run(self) -> dict:
try:
rv = []
with self.engine.begin() as conn:
cursor = conn.execute(text(self.query))
cursor = conn.exec_driver_sql(self.query)
for row in cursor:
result = row._asdict()
rv.append(result)
Expand Down
4 changes: 3 additions & 1 deletion patchwork/steps/CallShell/CallShell.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

import os
import shlex
import subprocess
from pathlib import Path

from patchwork.common.utils.utils import mustache_render
from patchwork.logger import logger
from patchwork.step import Step, StepStatus
from patchwork.steps import CallSQL
from patchwork.steps.CallShell.typed import CallShellInputs, CallShellOutputs


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

env: dict[str, str] = dict()
env: dict[str, str] = os.environ.copy()
for env_assign in env_spliter:
env_assign_spliter = shlex.shlex(env_assign, posix=True)
env_assign_spliter.whitespace_split = True
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "patchwork-cli"
version = "0.0.92"
version = "0.0.93"
description = ""
authors = ["patched.codes"]
license = "AGPL"
Expand Down

0 comments on commit 3b2ef62

Please sign in to comment.