MCPcopy Index your code
hub / github.com/tanelpoder/0xtools / get_column_to_source_mapping

Method get_column_to_source_mapping

xtop/core/query_engine.py:378–393  ·  view source on GitHub ↗

Get mapping of column names to their source data files

(self)

Source from the content-addressed store, hash-verified

376 self.logger.debug(f"Discovered schema for {source_name}: {len(result)} columns")
377
378 def get_column_to_source_mapping(self) -> Dict[str, str]:
379 """Get mapping of column names to their source data files"""
380 mapping = {}
381
382 for source_name, columns in self.schema_cache.items():
383 alias = self.DATA_SOURCES[source_name]['alias']
384 for col_name, _ in columns:
385 # Handle column name conflicts by prefixing with source alias
386 if col_name in mapping and mapping[col_name] != source_name:
387 # This column exists in multiple sources
388 prefixed_name = f"{alias}.{col_name}"
389 mapping[prefixed_name] = source_name
390 else:
391 mapping[col_name] = source_name
392
393 return mapping
394
395 def get_columns_by_source(self) -> Dict[str, List[str]]:
396 """Get columns grouped by their source"""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected