def sync_table(model):
if not issubclass(model, Model):<EOL><INDENT>raise CQLEngineException("<STR_LIT>")<EOL><DEDENT>if model.__abstract__:<EOL><INDENT>raise CQLEngineException("<STR_LIT>")<EOL><DEDENT>cf_name = model.column_family_name()<EOL>raw_cf_name = model.column_family_name(include_keyspace=False)<EOL>ks_name = model._get_keyspace()<EOL>cluster = get_cluster()<EOL>keyspace = cluster.metadata.keyspaces[ks_name]<EOL>tables = keyspace.tables<EOL>if raw_cf_name not in tables:<EOL><INDENT>qs = get_create_table(model)<EOL>try:<EOL><INDENT>execute(qs)<EOL><DEDENT>except CQLEngineException as ex:<EOL><INDENT>if "<STR_LIT>" not in unicode(ex):<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>fields = get_fields(model)<EOL>field_names = [x.name for x in fields]<EOL>for name, col in model._columns.items():<EOL><INDENT>if col.primary_key or col.partition_key: continue <EOL>if col.db_field_name in field_names: continue <EOL>query = "<STR_LIT>".format(cf_name, col.get_column_def())<EOL>logger.debug(query)<EOL>execute(query)<EOL><DEDENT>update_compaction(model)<EOL><DEDENT>table = cluster.metadata.keyspaces[ks_name].tables[raw_cf_name]<EOL>indexes = [c for n,c in model._columns.items() if c.index]<EOL>for column in indexes:<EOL><INDENT>if table.columns[column.db_field_name].index:<EOL><INDENT>continue<EOL><DEDENT>qs = ['<STR_LIT>'.format(raw_cf_name, column.db_field_name)]<EOL>qs += ['<STR_LIT>'.format(cf_name)]<EOL>qs += ['<STR_LIT>'.format(column.db_field_name)]<EOL>qs = '<STR_LIT:U+0020>'.join(qs)<EOL>execute(qs)<EOL><DEDENT>
Inspects the model and creates / updates the corresponding table and columns.

Note that the attributes removed from the model are not deleted on the database.
They become effectively ignored by (will not show up on) the model.