Search code examples
pythondatabasesqlitecursor

What is the cursor object in sqlite databases in python?


I worked with a sqlite databases in python then After databse connect as fllow db=sqlite3.connect("database.sqlite") we use db.cursor(). what is this cursor object ? Is it common in any DBMS ? Please explain


Solution

  • Cursors are indeed extremely common in all sorts of databases; the "run along" (that's what the root "cursor" means in Latin: "runner") results from queries (which in Python access to relational DB,s in particular, you execute on the cursor themselves), yielding them a little at a time, or all at once, at your choice.

    A sqlite3.Cursor instance has a few more methods and attributes, beyond those that other cursor objects in Python interfaces to DBs generally offer. However, you don't have to use them, and you often can keep better portability of your code by sticking closer to the general Python "DB API" you can study starting from https://wiki.python.org/moin/DatabaseProgramming/ and links therefrom.