def _build_median_table(self, metadata):
        origin_table = metadata.tables[self.table_name]
        origin_column = origin_table.c[self.key]
        table_name = self._get_table_name("m")
        median_table = Table(table_name, metadata,
                             Column("id", INT, primary_key=True),
                             Column("value", DECIMAL),
                             prefixes=['TEMPORARY'])
        for group in self.group_by:
            column = origin_table.c[group]
            median_table.append_column(Column(group, column.type))

        logger.debug("Building median table: %s", table_name)
        median_table.create()

        return median_table
Get PCI device by id.
dataset/ETHPy150Open dimagi/commcare-hq/custom/world_vision/custom_queries.py/CustomMedianQueryMeta._build_median_table--crossover with--dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/db/api.py/pci_device_get_by_id