When several records describe one order, their position in a file is not enough to keep them connected. A unique identifier gives each record a value that distinguishes it within a defined scope. For a CSV file, that scope can be just its own rows; an incrementing integer in a new column is enough to identify each one. section 10.2
Once records have identifiers, their values can do different jobs:
- Connect data: put a customer’s identifier in each related order. Put both an order identifier and a product identifier in an item record to connect orders with products. section 10.2
- Recognize a returning client: a server-generated session identifier lets the server relate successive requests to a user. Flask signs its session cookie so the browser can view it but cannot modify it without the secret key. section 8.1.1
- Find a user at login: an email address can serve as a unique, memorable lookup value, while a separate UUID-derived value can serve as the user record’s primary key. section 8.2.1
From an order to a user account
Suppose customer row 12 places two orders. Each order stores 12 to identify its customer; each item stores the identifiers of its order and product. In a user model, the same principle appears as a string primary key generated by `uuid4().hex`, alongside an email field marked unique. The identifier’s form changes, but its job remains to distinguish the right record in its context. section 10.2 section 8.2.1
Uniqueness does not make a value a useful human-readable name. A UUID may be practical for distinguishing records, yet a UUID-based Python variable name conveys little about what the variable means. Use identifiers to establish identity; use descriptive names when people need to understand the code. section 2.1








