Loading [MathJax]/extensions/tex2jax.js
LSST Applications g0485b4d2cb+c8d56b10d4,g0fba68d861+c513f10703,g1ec0fe41b4+3e153770da,g1fd858c14a+fca1f36da6,g2440f9efcc+8c5ae1fdc5,g35bb328faa+8c5ae1fdc5,g4d2262a081+73db4aee98,g53246c7159+8c5ae1fdc5,g56a49b3a55+8699aedcf1,g60b5630c4e+0e13f5d8e4,g65f11fe441+d5838b1573,g67b6fd64d1+035c836e50,g6ba5f4ee81+5218eae6c4,g78460c75b0+7e33a9eb6d,g786e29fd12+668abc6043,g8352419a5c+8c5ae1fdc5,g8852436030+5e76f8a839,g89139ef638+035c836e50,g94187f82dc+0e13f5d8e4,g989de1cb63+035c836e50,g9d31334357+0e13f5d8e4,g9f33ca652e+190f04d267,gabe3b4be73+8856018cbb,gabf8522325+21619da9f3,gb1101e3267+e14fd59f59,gb89ab40317+035c836e50,gc91f06edcd+a47578e525,gcef618a4dd+0e13f5d8e4,gcf25f946ba+5e76f8a839,gd6cbbdb0b4+958adf5c1f,gdb8242c116+18fb55f1cc,gde0f65d7ad+fe97e93be4,ge278dab8ac+83c63f4893,ge410e46f29+035c836e50,gf35d7ec915+97dd712d81,gf5e32f922b+8c5ae1fdc5,gf67bdafdda+035c836e50,gf6800124b1+a9633b82fa,w.2025.19
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
lsst.dax.apdb.scripts.create_cassandra Namespace Reference

Functions

None create_cassandra (str output_config, str|None ra_dec_columns, str|None table_options=None, **Any kwargs)
 
CreateTableOptions|None _read_table_options (str|None table_options=None)
 

Function Documentation

◆ _read_table_options()

CreateTableOptions | None lsst.dax.apdb.scripts.create_cassandra._read_table_options ( str | None table_options = None)
protected
Read contents of the table options file.

Definition at line 69 of file create_cassandra.py.

69def _read_table_options(table_options: str | None = None) -> CreateTableOptions | None:
70 """Read contents of the table options file."""
71 if not table_options:
72 return None
73
74 res = ResourcePath(table_options)
75 content = res.read()
76 stream = io.BytesIO(content)
77 if model_data := yaml.load(stream, Loader=yaml.SafeLoader):
78 return CreateTableOptions.model_validate(model_data)
79 return None

◆ create_cassandra()

None lsst.dax.apdb.scripts.create_cassandra.create_cassandra ( str output_config,
str | None ra_dec_columns,
str | None table_options = None,
**Any kwargs )
Create new APDB instance in Cassandra cluster.

Parameters
----------
output_config : `str`
    Name of the file to write APDB configuration.
ra_dec_columns : `str` or `None`
    Comma-separated list of names for ra/dec columns in DiaObject table.
table_options : `str`, optional
    Path or URI of the YAML file with table options.
**kwargs
    Keyword arguments passed to `ApdbCassandra.init_database` method.

Definition at line 36 of file create_cassandra.py.

38) -> None:
39 """Create new APDB instance in Cassandra cluster.
40
41 Parameters
42 ----------
43 output_config : `str`
44 Name of the file to write APDB configuration.
45 ra_dec_columns : `str` or `None`
46 Comma-separated list of names for ra/dec columns in DiaObject table.
47 table_options : `str`, optional
48 Path or URI of the YAML file with table options.
49 **kwargs
50 Keyword arguments passed to `ApdbCassandra.init_database` method.
51 """
52 options = _read_table_options(table_options)
53 ra_dec_tuple: tuple[str, str] | None = None
54 if ra_dec_columns:
55 ra_dec_list = ra_dec_columns.split(",")
56 if len(ra_dec_list) != 2:
57 raise ValueError(f"--ra-dec-columns must specify exactly two columns: {ra_dec_columns}")
58 ra_dec_tuple = (ra_dec_list[0], ra_dec_list[1])
59 kwargs["hosts"] = kwargs.pop("host")
60 config = ApdbCassandra.init_database(ra_dec_columns=ra_dec_tuple, table_options=options, **kwargs)
61 config.save(output_config)
62 if output_config.endswith(".py"):
63 warnings.warn(
64 "APDB configuration is now saved in YAML format, "
65 "output file should use .yaml extension instead of .py."
66 )
67
68