87def cassandra_config_options(parser: argparse.ArgumentParser) -> None:
88 """Define Cassandra backend configuration options."""
89 group = parser.add_argument_group("Cassandra backend options")
90 _option_from_pex_field(
91 group,
92 ApdbCassandraConfig.use_insert_id_skips_diaobjects,
93 name="--replica-skips-diaobjects",
94 action="store_true",
95 )
96 _option_from_pex_field(group, ApdbCassandraConfig.port, type=int, metavar="PORT")
97 _option_from_pex_field(group, ApdbCassandraConfig.username, metavar="USER")
98 _option_from_pex_field(group, ApdbCassandraConfig.prefix)
99 group.add_argument(
100 "--replication-factor", help="Replication factor used when creating new keyspace.", type=int
101 )
102 group.add_argument(
103 "--table-options", help="Path or URI of YAML file containing table options.", metavar="URI"
104 )
105 _option_from_pex_field(
106 group, ApdbCassandraConfig.read_consistency, choices=["ONE", "TWO", "THREE", "QUORUM", "ALL"]
107 )
108 _option_from_pex_field(
109 group, ApdbCassandraConfig.write_consistency, choices=["ONE", "TWO", "THREE", "QUORUM", "ALL"]
110 )
111 _option_from_pex_field(group, ApdbCassandraConfig.read_timeout, type=int, metavar="SECONDS")
112 _option_from_pex_field(group, ApdbCassandraConfig.write_timeout, type=int, metavar="SECONDS")
113 _option_from_pex_field(
114 group,
115 ApdbCassandraConfig.ra_dec_columns,
116 help="Names of ra/dec columns in DiaObject table, comma-separated.",
117 metavar="RA_COLUMN,DEC_COLUMN",
118 )
119 group = parser.add_argument_group("Cassandra partitioning options")
120 _option_from_pex_field(group, ApdbCassandraConfig.part_pixelization, metavar="NAME")
121 _option_from_pex_field(group, ApdbCassandraConfig.part_pix_level, type=int, metavar="LEVEL")
122 _option_from_pex_field(group, ApdbCassandraConfig.time_partition_tables, action="store_true")
123 _option_from_pex_field(group, ApdbCassandraConfig.time_partition_start, metavar="TIME")
124 _option_from_pex_field(group, ApdbCassandraConfig.time_partition_end, metavar="TIME")