An industry type restricts a company’s industry value to approved categories instead of accepting arbitrary text. In a company database, defining it as a database ENUM adds validation at the field level while keeping the allowed list small and relatively stable. section 10.2.1
Choose the implementation according to how the categories will be managed:
- Use a database-defined type when the set of values is limited and changes infrequently. section 10.2.1
- Use strings or numeric values with labels elsewhere when application needs or team preferences favor flexible storage. section 10.2.1
- Use a separate table when adding categories would otherwise require database change requests or when the application needs a managed lookup list. section 10.2.1
Company database and API
Define industry_type with categories such as basic materials, healthcare, technology, and utilities, then use INDUSTRY_TYPE for the nullable industry column in company. Mirror those values in a Python IndustryType enumeration and use it in the API response model so returned company data remains constrained.
