Skip to content

Instantly share code, notes, and snippets.

@codephillip
Last active January 4, 2018 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codephillip/349664f3a761f579ee6b682a152e53e8 to your computer and use it in GitHub Desktop.
Save codephillip/349664f3a761f579ee6b682a152e53e8 to your computer and use it in GitHub Desktop.
class TestTable(ndb.Model):
fb_page_id = ndb.StringProperty()
date = ndb.StringProperty()
step = ndb.IntegerProperty()
if not isLocal():
from google.appengine.ext import ndb
print("started")
import random
test_page = random.randint(100000000, 99999999999999)
sci_key = ndb.Key(TestTable, test_page)
sci = sci_key.get()
if not sci:
sci = TestTable()
sci.key = sci_key
sci.fb_page_id = str(test_page)[:8]
import datetime, time
sci.date = str(int(time.mktime(datetime.datetime.now().timetuple()) * 1000))
sci.put()
sci_count = TestTable.query().count()
items = TestTable.query().fetch()
# ndb.delete_multi(
# TestTable.query().fetch(keys_only=True)
# )
print(sci_count)
print(items)
print("ended")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment