Skip to content

Library to manage databases (sql and no sql) with python

License

Notifications You must be signed in to change notification settings

alekay2200/database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DataBase

Library to manage databases (sql and no sql) with python. For now only provide a class to operate with a mongo database.

Dependencies

  • Pymongo --> pip install pymongo==4.0.1

Use of SELECT

Now if you want to use select operation, you should close the cursor given from the function, so, in order to implement these new feature on pymongo v4 use with statement. Let's see an example:

select function return MyCursor object. These object store the information from the query and the connection with the database
query = db.select({}, COLLECTION, fields={"Timestamp"}, sort_fields=[("Timestamp", ASCENDING)], limit=20)

Using with statement the user can get cursor object and iterate over documents
with query as cursor:
        for doc in cursor:
              print(doc)

When with statement finish, the connection and the cursor will be closed automatically

About

Library to manage databases (sql and no sql) with python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages