(self)
| 912 | return self._columns.as_readonly() |
| 913 | |
| 914 | def _setup_collections(self) -> None: |
| 915 | with util.mini_gil: |
| 916 | # detect another thread that raced ahead |
| 917 | if "_columns" in self.__dict__: |
| 918 | assert "primary_key" in self.__dict__ |
| 919 | assert "foreign_keys" in self.__dict__ |
| 920 | return |
| 921 | |
| 922 | _columns: ColumnCollection[Any, Any] = ColumnCollection() |
| 923 | primary_key = ColumnSet() |
| 924 | foreign_keys: Set[KeyedColumnElement[Any]] = set() |
| 925 | |
| 926 | self._populate_column_collection( |
| 927 | columns=_columns, |
| 928 | primary_key=primary_key, |
| 929 | foreign_keys=foreign_keys, |
| 930 | ) |
| 931 | |
| 932 | # assigning these three collections separately is not itself |
| 933 | # atomic, but greatly reduces the surface for problems |
| 934 | self._columns = _columns |
| 935 | self.primary_key = primary_key # type: ignore |
| 936 | self.foreign_keys = foreign_keys # type: ignore |
| 937 | |
| 938 | @util.ro_non_memoized_property |
| 939 | def entity_namespace(self) -> _EntityNamespace: |
no test coverage detected