PyLamarr
Pythonizations for the ultra-fast simulation option for the LHCb experiment
 
Loading...
Searching...
No Matches
Concatenate.py
1from typing import Tuple, Optional, Union
2from dataclasses import dataclass
3
4from pydantic import validate_arguments, validator
5
6from PyLamarr import RemoteResource, Wrapper
7
8
9@validate_arguments
10@dataclass(frozen=True)
12 """Concatenate multiple tables. Implements SQLamarr.TemporaryTable."""
13 output_table: str
14 input_tables: Tuple[str, ...]
15 columns: Tuple[str, ...]
16 make_persistent: bool = True
17
18 def query(self):
19 return list(
20 f"SELECT {', '.join(self.columns)} FROM {t}" for t in self.input_tables
21 )
22
23 implements: str = "TemporaryTable"
24
25 @property
26 def config(self):
27 return dict(
28 output_table=self.output_table,
29 outputs=self.columns,
30 query=self.query(),
31 make_persistent=self.make_persistent
32 )
33
34
35
36
37
Concatenate multiple tables.