Python Forum
creating a range of unique & sequential ID's in a database while handling concurency - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/Forum-Web-Scraping-Web-Development)
+--- Thread: creating a range of unique & sequential ID's in a database while handling concurency (/Thread-creating-a-range-of-unique-sequential-ID-s-in-a-database-while-handling-concurency)



creating a range of unique & sequential ID's in a database while handling concurency - jertel - Sep-19-2019

I am in the planning phase of a project to create an app. I am wondering if anyone has any general strategy for what I outline below.

I have a need for an application that will create a range of unique and sequential numbers. The numbers have to be unique, and they have to sequential.

For instance if 6548 was the last ID created and a user requests 20 numbers, and the system would spit out something like: "Created numbers 6549 - 6568".

Of course there are more things in the model than just these numbers, but my big concern is how to handle multiple users requesting ranges of numbers at the same time and ensuring that they get a unique and sequential range of Id's.