Skip to content

append/update a database entry #235

Answered by B0TAlan
B0TAlan asked this question in Q&A
Discussion options

You must be logged in to vote

I found this article which led to this GitHub which then I modified to have a function that did what I wanted
modded code:

    'class DatabaseBase()
    def updateByTitle(self, header, title, row_cells): # modded 'updateByNumber' to gets row by the title 
    db_rows = self.query()
    page_id = None
    for row in db_rows['results']:
        user_id = safe_get(row, 'properties.' + header + '.title.0.plain_text')
        
        if user_id == title:
            page_id = row["id"]
    
    if not page_id:
        print("not find recork with header = {}, title = {}".format(header, title))
    #else: print(page_id)
    
    properties = {}
    for cell in row_cells:
        properties[cell…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by B0TAlan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant