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

Method find_tables

actions/steal_data_sql.py:50–70  ·  view source on GitHub ↗

Find all tables in all databases, excluding system databases.

(self, engine)

Source from the content-addressed store, hash-verified

48 return None
49
50 def find_tables(self, engine):
51 """
52 Find all tables in all databases, excluding system databases.
53 """
54 try:
55 if self.shared_data.orchestrator_should_exit:
56 logger.info("Table search interrupted due to orchestrator exit.")
57 return []
58 query = """
59 SELECT TABLE_NAME, TABLE_SCHEMA
60 FROM INFORMATION_SCHEMA.TABLES
61 WHERE TABLE_SCHEMA NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')
62 AND TABLE_TYPE = 'BASE TABLE'
63 """
64 df = pd.read_sql(query, engine)
65 tables = df[['TABLE_NAME', 'TABLE_SCHEMA']].values.tolist()
66 logger.info(f"Found {len(tables)} tables across all databases")
67 return tables
68 except Exception as e:
69 logger.error(f"Error finding tables: {e}")
70 return []
71
72 def steal_data(self, engine, table, schema, local_dir):
73 """

Callers 1

executeMethod · 0.95

Calls 2

infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected