validate this column: return the compared against itemsize
(self, itemsize=None)
| 2354 | self.set_attr() |
| 2355 | |
| 2356 | def validate_col(self, itemsize=None): |
| 2357 | """validate this column: return the compared against itemsize""" |
| 2358 | # validate this column for string truncation (or reset to the max size) |
| 2359 | if self.kind == "string": |
| 2360 | c = self.col |
| 2361 | if c is not None: |
| 2362 | if itemsize is None: |
| 2363 | itemsize = self.itemsize |
| 2364 | if c.itemsize < itemsize: |
| 2365 | raise ValueError( |
| 2366 | f"Trying to store a string with len [{itemsize}] in " |
| 2367 | f"[{self.cname}] column but\nthis column has a limit of " |
| 2368 | f"[{c.itemsize}]!\nConsider using min_itemsize to " |
| 2369 | "preset the sizes on these columns" |
| 2370 | ) |
| 2371 | return c.itemsize |
| 2372 | |
| 2373 | return None |
| 2374 | |
| 2375 | def validate_attr(self, append: bool) -> None: |
| 2376 | # check for backwards incompatibility |
no outgoing calls
no test coverage detected