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 9108425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:48:21+00:00 2026-06-17T02:48:21+00:00

In old google appengine datastore API required and default could be used together for

  • 0

In old google appengine datastore API “required” and “default” could be used together for property definitions. Using ndb I get a

ValueError: repeated, required and default are mutally exclusive.

Sample code:

from google.appengine.ext import ndb
from google.appengine.ext import db

class NdbCounter(ndb.Model):
    # raises ValueError
    count = ndb.IntegerProperty(required=True, default=1)

class DbCounter(db.Model):
    # Doesn't raise ValueError
    count = db.IntegerProperty(required=True, default=1)

I want to instantiate a Counter without having to specify a value. I also want to avoid someone to override that value to None. The example above is constructed. I could probably live without a required attribute and instead add an increment() method. Still I don’t see the reason why required and default are mutually exclusive.

Is it a bug or a feature?

  • 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-17T02:48:22+00:00Added an answer on June 17, 2026 at 2:48 am

    I think you are right. Perhaps I was confused when I write that part of the code. It makes sense that “required=True” means “do not allow writing the value None” so it should be possible to combine this with a default value. Please file a feature request in the NDB tracker: http://code.google.com/p/appengine-ndb-experiment/issues/list

    Note that for repeated properties things are more complicated, to repeated will probably continue to be incompatible with either required or default, even if the above feature is implemented.

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

Sidebar

Related Questions

I'm building a Java application that involves Google Docs API. I'm using the old
I have been trying to follow this old Google tutorial (could be the problem)
I am making an application for google-appengine. I am using google app engine sdk
In the old Google Chart API it was possible to use PHP to render
I've set up an AppEngine account using Google Apps Authentication and I've resigned myself
In the old static image Google charts I have been producing a combined chart
Currently what is happening is people are accessing old URLs from google like icpaweb.com/site/pages/about-us/
Google, Github and Stackoverflow bring up django-schedule and django-mailer, but these are both old
Update 2022 There is cloud sql proxy now: https://cloud.google.com/sql/docs/mysql/sql-proxy#how-works Old Question I am currently
I'm getting back to programming for Google App Engine and I've found, in old,

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.