<commit_before>from models import *

# create one record

user = User.create(name="jack", email="<EMAIL>")

print user._id  # get primary key's value

# create one record with method 'save'

user = User(name="myname")

user.save()  # return id

# update this user

user.email = "newemail"

user.save()

# if user in User table?

print user in User

# update, return updated rows number
print User.where(name="myname").update(name="newname")

# delete

user.destroy()

# or this way:
User.at(2).delete()

# join query

for user, post in (User & Post).where(
    User.id == Post.user_id
).select().fetchall():
    print user, post

# user defined method for Model

user = User.get(3)<commit_msg>exmaple for joinmodel.delete<commit_after>from models import *

# create one record

user = User.create(name="jack", email="<EMAIL>")

print user._id  # get primary key's value

# create one record with method 'save'

user = User(name="myname")

user.save()  # return id

# update this user

user.email = "newemail"

user.save()

# if user in User table?

print user in User

# update, return updated rows number
print User.where(name="myname").update(name="newname")

# delete

user.destroy()

# or this way:
User.at(2).delete()

# join query

for user, post in (User & Post).where(
    User.id == Post.user_id
).select().fetchall():
    print user, post

print (User&Post).where(User.id == Post.user_id).delete(User)  # delete from table user

# user defined method for Model

user = User.get(3)
{'fraction_non_alphanumeric': 0.13758389261744966, 'fraction_numerical': 0.0026845637583892616, 'mean_word_length': 4.088737201365188, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5474146', 'n_tokens_mistral': 504, 'n_tokens_neox': 508, 'n_words': 158}