Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9090801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:27:35+00:00 2026-06-16T22:27:35+00:00

Suppose I have an entity in my datastore that I know it can have

  • 0

Suppose I have an entity in my datastore that I know it can have a unique key_name deriving from a combination of it’s properties:

Example:

class Render(db.Model):

    #Math props
    x_size = db.IntegerProperty()
    y_size = db.IntegerProperty()
    center_axis_x = db.FloatProperty()
    center_axis_y = db.FloatProperty()
    center_axis_z = db.FloatProperty()
    iterations = db.IntegerProperty()

I am sure that there can be no other entity with the exact same properties so in order to create the unique key I user so far:

render_key=hashlib.md5(str(properties.x_size) +
                                str(properties.y_size) +
                                str(properties.iterations) +
                                str(properties.center_axis_x) +
                                str(properties.center_axis_y) +
                                str(properties.center_axis_z)
                                ).hexdigest()

The hexdigest let’s me make the key url-safe and user friendly but I believe it might need discussion as well.

So to the question. In the above scenario or an altered version of that, are there any other better ways to achieve the same result? It doesn’t need to be backward compatible. So even if the final key differs from the one generated by my method it’s not a problem.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:27:36+00:00Added an answer on June 16, 2026 at 10:27 pm

    Overall your plan is good, except that md5 doesn’t guarantee that you won’t have collisions (although it’s very unlikely). You can make collisions even more unlikely by using SHA-256 instead, or just don’t hash it and you’re good to go.

    Depends on whether you’re ok with living with the very rare case that a collision does occur and you overwrite the wrong entity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have an entity class that stores a username: class Profile { private
Suppose I have an entity in Fluent NHibernate that looks like this: public class
Suppose I have an entity object defined as public partial class Article { public
Suppose I have public class Product: Entity { public IList<Item> Items { get; set;
Suppose I have the following 2 entities: @Entity public class Person implements Serializable {
Suppose I have a static method of my class that returns an object of
I have a rather large class stored in the datastore, for example a User
If I have an entity derived from db.Expando I can write Dynamic property by
Suppose I have the following data structure: a Customer entity that has a collection
Technology: Hibernate 3.0 Suppose i have Entity class Company @Entity @Table(name=tbl_companies) public class Company

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.