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 _option_from_pex_field(
103 group, ApdbCassandraConfig.read_consistency, choices=["ONE", "TWO", "THREE", "QUORUM", "ALL"]
104 )
105 _option_from_pex_field(
106 group, ApdbCassandraConfig.write_consistency, choices=["ONE", "TWO", "THREE", "QUORUM", "ALL"]
107 )
108 _option_from_pex_field(group, ApdbCassandraConfig.read_timeout, type=int, metavar="SECONDS")
109 _option_from_pex_field(group, ApdbCassandraConfig.write_timeout, type=int, metavar="SECONDS")
110 _option_from_pex_field(
111 group,
112 ApdbCassandraConfig.ra_dec_columns,
113 help="Names of ra/dec columns in DiaObject table, comma-separated.",
114 metavar="RA_COLUMN,DEC_COLUMN",
115 )
116 group = parser.add_argument_group("Cassandra partitioning options")
117 _option_from_pex_field(group, ApdbCassandraConfig.part_pixelization, metavar="NAME")
118 _option_from_pex_field(group, ApdbCassandraConfig.part_pix_level, type=int, metavar="LEVEL")
119 _option_from_pex_field(group, ApdbCassandraConfig.time_partition_tables, action="store_true")
120 _option_from_pex_field(group, ApdbCassandraConfig.time_partition_start, metavar="TIME")
121 _option_from_pex_field(group, ApdbCassandraConfig.time_partition_end, metavar="TIME")