Duplicate prohibition processing in GAE / Python Datastore

When I looked it up, it seems that I can set it uniquely using Key_name, but I didn't feel like I tried it, so I applied select and saved it if there was no match.

def SaveMusic(minfo,rank_info):
    MusicModel = Music()
    MusicModel.category = rank_info['category']
    MusicModel.title = minfo['title']
    MusicModel.artistName = minfo['artist']
    entity = Music.gql("WHERE title = :title", title=minfo['title'])
    if entity is None:
        MusicModel.put()

The title field is not duplicated.

Recommended Posts

Duplicate prohibition processing in GAE / Python Datastore
File processing in Python
Multithreaded processing in python
Text processing in Python
Duplicate combinations in Python
Queue processing in Python
UTF8 text processing in python
Asynchronous processing (threading) in python
Image Processing Collection in Python
Using Python mode in Processing
Signal processing in Python (1): Fourier transform
100 Language Processing Knock Chapter 1 in Python
Easy image processing in Python with Pillow
Status of each Python processing system in 2020
Quadtree in Python --2
Python in optimization
Asynchronous processing in Python: asyncio reverse lookup reference
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
SendKeys in Python
python image processing
Meta-analysis in Python
Unittest in python
Type Python scripts to run in QGIS Processing
View the result of geometry processing in Python
I investigated in detail about variable processing in python
Epoch in Python
A program that removes duplicate statements in Python
Sudoku in Python
DCI in Python
Python file processing
quicksort in python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Constant in python
Python: Deep Learning in Natural Language Processing: Basics
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
StepAIC in Python
Y / n processing in bash, python and Go
To write to Error Repoting in Python on GAE
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Reflection in Python
Parallel processing with no deep meaning in Python
Constant in python
nCr in Python.
format in python
PPAP in Python
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python