Giter VIP home page Giter VIP logo

anodb's People

Contributors

zx80 avatar

Stargazers

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

Watchers

 avatar

Forkers

enigmacurry

anodb's Issues

Error checking for mariadb connection type

Theres a typo in the check for mariadb, it should be self._db not self.db:

musicsite-api-1       |   File "/usr/local/lib/python3.11/site-packages/anodb.py", line 88, in __init__
musicsite-api-1       |     self._conn = self._connect()
musicsite-api-1       |                  ^^^^^^^^^^^^^^^
musicsite-api-1       |   File "/usr/local/lib/python3.11/site-packages/anodb.py", line 188, in _connect
musicsite-api-1       |     elif self.db == "mariadb":  # pragma: no cover
musicsite-api-1       |          ^^^^^^^
musicsite-api-1       | AttributeError: 'DB' object has no attribute 'db'. Did you mean: '_db'?

Python 3.9 support

Thank you for your time on this package, it's a really elegant way to interface with aiosql.

I'm stuck on Python 3.9 for the moment because one of my libraries isn't compatible with 3.10+ (appdynamics). Would it be possible to bring back 3.9 support? Probably would mean having to use the old union type syntax, sorry.

I saw this comment mentioning 3.7 and 3.8 weren't compatible:

# NOTE asyncpg does not compile with pypy 3.7 & 3.8

Transaction control

Hi,

when using psycopg (and I think also sqlite) directly, we can control transaction scope by using the connection object. This remains true even when we use aiosql, because the connection object is "outside" the aiosql object. For example:

conn = psycopg.connect("service=foo", autocommit=True)
queries = aiosql.from_path("queries.sql")
with conn.transaction():
    queries.insert_foo(conn, foo="foo")
    queries.insert_bar(conn, bar="bar")
crunch_numbers_furiously_for_hours()
with conn.transaction():
    queries.insert_baz(conn, baz="baz")

But with anodb, as it is now, I have to rely on peeking inside your object and (ab)using the ostensibly private _conn member. So you should consider one of:

  1. Expose the _conn member, maybe just with a getter method, or
  2. Make your own transaction interface, maybe by forwarding some methods calls automatically to _conn

Thanks for your attention,

--
Ian

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.