question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Only one UniqueID will be find

See original GitHub issue

Info

pyVersion: Python 3.10 OS: Windows 10

Describe the bug

Only the latest added entry can be found else this error accrued pysondb.errors.db_errors.IdNotFoundError: Id '184766099262345250' does not exist in the JSON db How to reproduce

GET Output

[
  {
    "id": 130978302791852290, 
    "name": "lol", 
    "state": true
  }, 
  {
    "id": 184766099262345253, 
    "name": "lol", 
    "state": true
  }, 
  {
    "id": 135312220569528861, 
    "name": "lol", 
    "state": true
  }
]

Used Code e.g. Delete Data by ID

        id = data["id"]
        database=db.getDb("data.json")
        #id =database.getBy({"id":id})
        database.deleteById(id)
        return id + " deleted"

If I delete the last one ID in this Out here 135312220569528861 this works fine but another IDs couln’t be found. Expected behavior

Find the correct ID

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fredysomycommented, Feb 13, 2022

that was a patch for another issue

1reaction
fredysomycommented, Feb 13, 2022

Hey . Thanks for the info,

Will get back to you.

On Sun, 13 Feb 2022, 10:42 am Dominic Schubert, @.***> wrote:

def jsondb_get(): database=db.getDb(databaseFile) return database.getAll()

def jsondb_delete(id): database=db.getDb(databaseFile) return database.deleteById(id)

def jsondb_update(id, data): database=db.getDb(databaseFile) return database.updateById(id,data)

@app.route(“/api”,methods=[“POST”,“PUT”,“GET”,“DELETE”,“PATCH”]) def api(): data = request.form methode = request.method

match methode:
    case "GET":
        database=db.getDb("data.json")
        return jsonify(jsondb_get())

    case "POST":
        database=db.getDb(databaseFile)
        type = data["type"]
        match type:
            case "add":
                name = data["name"]
                database.add({"name":name,"state":True})
                return name + " added"

            case "update":
                id = data["id"]
                data = data["data"]
                #database.update({"name":"Pyson-CLI"},{"name":"PysonCLI"})
                data = {"name":data}
                jsondb_update(id, data)
                return data + " updated"

    case "DELETE":
        id = data["id"]
        jsondb_delete(id)
        return id + " deleted"

A bit more Code from my example Project 😃

— Reply to this email directly, view it on GitHub https://github.com/pysonDB/pysonDB/issues/87#issuecomment-1037784749, or unsubscribe https://github.com/notifications/unsubscribe-auth/APXKHABJ7QRTZZJ2LV5TJ43U244SVANCNFSM5OIFNSTA . You are receiving this because you were mentioned.Message ID: @.***>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Need IF VLOOKUP to search more than just the first ...
IF VLOOKUP is only searching the first occurrence of the unique ID rather than searching until it finds the unique ID that meets...
Read more >
UNIQUEID() - AppSheet Help
UNIQUEID() (with no argument) generates a sequence of 8 random digits and letters suitable for use as a unique identifier within the app,...
Read more >
How to Generate Unique ID in JavaScript - DEV Community ‍ ‍
Using UUID​​ UUID is the abbreviation of univerally unique identifier, which is an identification number to uniquely identify something. The main ...
Read more >
Solved: How can I find unique IDs that match one search bu...
The id field corresponds to a device ID. I'm trying to find all the unique devices (i.e., unique id s) that are still...
Read more >
c# - All Returned EmailMessages Have Same Unique Id String
Unique Ids are unique for EWS items. I ran across this question because I thought I was having the same issue. It turns...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found