MCPcopy Index your code
hub / github.com/dbcli/mycli / execute_from_file

Method execute_from_file

mycli/client_commands.py:145–160  ·  view source on GitHub ↗
(self, arg: str, **_)

Source from the content-addressed store, hash-verified

143 yield SQLResult(status=msg)
144
145 def execute_from_file(self, arg: str, **_) -> Iterable[SQLResult]:
146 if not arg:
147 message = "Missing required argument: filename."
148 return [SQLResult(status=message)]
149 try:
150 with open(os.path.expanduser(arg)) as f:
151 query = f.read()
152 except IOError as e:
153 return [SQLResult(status=str(e))]
154
155 if self.destructive_warning and confirm_destructive_query(self.destructive_keywords, query) is False:
156 message = "Wise choice. Command execution stopped."
157 return [SQLResult(status=message)]
158
159 assert isinstance(self.sqlexecute, SQLExecute)
160 return self.sqlexecute.run(query)
161
162 def change_prompt_format(self, arg: str, **_) -> list[SQLResult]:
163 """

Calls 4

SQLResultClass · 0.90
readMethod · 0.80
runMethod · 0.45