Giter Club home page Giter Club logo

minidb's People

Contributors

anthraxx avatar jwilk avatar mcepl avatar mwerlen avatar paolostivanin avatar thp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minidb's Issues

Descending order_by?

I would like to fetch rows in reverse order.
Is there a way to add a DESC to the order_by parameter of a query?

Python 3.8 Syntax Warning

Hi! When working on urlwatch, I ran into the following warning while running the project with Python 3.8.2:

/.../urlwatch/venv/lib/python3.8/site-packages/minidb-2.0.2-py3.8.egg/minidb.py:144: SyntaxWarning: "is" with a literal. Did you mean "=="?

I also encountered this error when importing it via python repl, and when trying to run the tests.

I can confirm that downgrading the environment to 3.7 resolves the warning - and found a description of this change in Python 3.8 here:
https://adamj.eu/tech/2020/01/21/why-does-python-3-8-syntaxwarning-for-is-literal/

This is a warning, and not a breaking issue - and it's possible to silence the warning:
https://docs.python.org/2/library/warnings.html#temporarily-suppressing-warnings

But also, the change required to correct the issue looks minimal, and the warning has been introduced to highlight potentially unexpected behavior in the previous convention.

The biggest issue with this warning is that downstream developers, using a project that uses minidb (such as urlwatch). The warning adds confusion for them (took me a second to confirm my environment was properly configured), and they may mistake it as an error traceback and think something's wrong.

Suggested fix is to convert the is statements here to == as recommended by the warning, as this is also backwards compatible with Python 3.7, 3.6 and 2.7:
https://github.com/thp/minidb/blob/master/minidb.py#L144

Happy to submit the PR if my suggested fix is acceptable ๐ŸŽ‰

Add LICENSE file

Please add a LICENSE which can be shipped with the package.

Thanks.

Persistent database acts like In-Memory database

Summary

It appears that the persistence of the data in a database file is not persistent at all, but all in-memory.

Background

I have created a new Store object with a filename parameter. The database file is created. The code uses a custom class that extends minidb.Model. The data is held in the custom Model class that I created and I can call .save(...) and .load(...) with the correct results outputted to me.

However, when I try to view the data in the database in a 3rd party app. Nothing shows up in the db table!

I tried to only .save(...) the results to the databases in one run-session, and then .load(...) the persisted data in another run-session. However, no data was loaded in my program at all.

Code

This code works and displays the contents of the "database" to the console; however, nothing appears in the database file.

class AndroidStudioRelease(minidb.Model):
    date = str
    name = str
    category = str
    release_type = str
    filename = str
    location = str
    sha256 = str
    filetype = str
    platform = str

...

db = minidb.Store('android-studio-downloads')
db.register(AndroidStudioRelease)

...

release = AndroidStudioRelease(date=date, name=name, category=category, release_type=release_type, filename=filename, location=download_location, sha256=sha256, filetype=filetype, platform=platform)
release.save(db)

...

for release in AndroidStudioRelease.load(db, (AndroidStudioRelease.c.platform == "Linux") & (AndroidStudioRelease.c.category == "Preview")):
    print(release)

Where in query with and

Hi,

How to use 'where' with the conditional 'and'? I tried use like this: but not working:

where=(self.proxy.c.qtd_uso != 0 and self.proxy.c.tentativa_uso<=10)

Python 2 compatibility

Hi,
I see that tests fail with Python 2 and you mentioned that this module is made for Python 3. Does it mean it does not support Python 2? In this case I guess urlwatch doesn't either.

  File "minidb.py", line 70
    ...
    ^
SyntaxError: invalid syntax

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.