(model, table_meta)
| 290 | |
| 291 | |
| 292 | def _validate_pk(model, table_meta): |
| 293 | model_partition = [c.db_field_name for c in model._partition_keys.values()] |
| 294 | meta_partition = [c.name for c in table_meta.partition_key] |
| 295 | model_clustering = [c.db_field_name for c in model._clustering_keys.values()] |
| 296 | meta_clustering = [c.name for c in table_meta.clustering_key] |
| 297 | |
| 298 | if model_partition != meta_partition or model_clustering != meta_clustering: |
| 299 | def _pk_string(partition, clustering): |
| 300 | return "PRIMARY KEY (({0}){1})".format(', '.join(partition), ', ' + ', '.join(clustering) if clustering else '') |
| 301 | raise CQLEngineException("Model {0} PRIMARY KEY composition does not match existing table {1}. " |
| 302 | "Model: {2}; Table: {3}. " |
| 303 | "Update model or drop the table.".format(model, model.column_family_name(), |
| 304 | _pk_string(model_partition, model_clustering), |
| 305 | _pk_string(meta_partition, meta_clustering))) |
| 306 | |
| 307 | |
| 308 | def sync_type(ks_name, type_model, connection=None): |
no test coverage detected