From anthony.tuininga at gmail.com Thu Dec 1 12:10:29 2022 From: anthony.tuininga at gmail.com (Anthony Tuininga) Date: Thu, 1 Dec 2022 10:10:29 -0700 Subject: [DB-SIG] python-oracledb 1.2.1 Message-ID: What is python-oracledb? python-oracledb is a Python extension module that enables access to Oracle Database for Python and conforms to the Python database API 2.0 specifications with a number of enhancements. This module is intended to eventually replace cx_Oracle. Where do I get it? https://pypi.org/project/oracledb/1.2.1/ The easiest method to install/upgrade python-oracledb is via pip as in python -m pip install oracledb --upgrade What's new? This release addresses a number of reported issues. See the full release notes for all of the details: https://python-oracledb.readthedocs.io/en/latest/release_notes.html#oracledb-1-2-1-december-2022 Please provide any feedback via GitHub issues: https://github.com/oracle/ python-oracledb/issues or discussions: https://github.com/oracle/python- oracledb/discussions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike_mp at zzzcomputing.com Fri Dec 2 11:34:15 2022 From: mike_mp at zzzcomputing.com (Mike Bayer) Date: Fri, 02 Dec 2022 11:34:15 -0500 Subject: [DB-SIG] intent of "numeric" paramstyle, wrt actual numbers not numerically ordered? Message-ID: <4b76f98d-0097-4951-bae0-ec30688afff3@app.fastmail.com> Does numeric paramstyle intend to support statements where the numbers are not numerically ordered within the statement? For example: select count(*) from my_table where a=:3 and b=:4 and c=:1 and d=:5 and e=:2 if so, what is the expected form of the positional tuple? Consider this data: insert into my_table(a, b, c, d, e) values ('a', 'b', 'c', 'd', 'e') to match this row, if we assume the positional tuple's contents should correspond to the numbers in the statement assuming 1-based ordering, we would expect this statement to match the row: cursor.execute( """select count(*) from my_table where a=:3 and b=:4 and c=:1 and d=:5 and e=:2""", ("c", "e", "a", "b", "d") ) OTOH, if we did not expect the numbers to be significant, and they are basically more interesting looking question marks where we dont care about the number, we'd expect this to match: cursor.execute( """select count(*) from my_table where a=:3 and b=:4 and c=:1 and d=:5 and e=:2""", ("a", "b", "c", "d", "e"), ) Apparently Python sqlite3 module, which has been in production for decades at this point in billions of computers, seems to honor the second form, and an issue search has not shown anyone ever noticing. I've raised an issue at https://github.com/python/cpython/issues/99953 It would appear this might speak to the relative un-popularity of "numeric" paramstyle, though that doesn't change my own process here, which is to try to support it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mal at egenix.com Fri Dec 2 12:14:21 2022 From: mal at egenix.com (Marc-Andre Lemburg) Date: Fri, 2 Dec 2022 18:14:21 +0100 Subject: [DB-SIG] intent of "numeric" paramstyle, wrt actual numbers not numerically ordered? In-Reply-To: <4b76f98d-0097-4951-bae0-ec30688afff3@app.fastmail.com> References: <4b76f98d-0097-4951-bae0-ec30688afff3@app.fastmail.com> Message-ID: <5bec489c-fc82-3cf5-76b6-6eb6fbbdfb64@egenix.com> On 02.12.2022 17:34, Mike Bayer wrote: > Does numeric paramstyle intend to support statements where the numbers > are not numerically ordered within the statement? For example: > > select count(*) from my_table where a=:3 and b=:4 and c=:1 and d=:5 > and e=:2 > > > if so, what is the expected form of the positional tuple? Consider > this data: > > insert into my_table(a, b, c, d, e) values ('a', 'b', 'c', 'd', 'e') > > to match this row, if we assume the positional tuple's contents should > correspond to the numbers in the statement assuming 1-based ordering, > we would expect this statement to match the row: > > cursor.execute( > ??? """select count(*) from my_table where a=:3 and b=:4 and c=:1 and > d=:5 and e=:2""", > ??? ("c", "e", "a", "b", "d") > ) > PEP 249 is a bit vague on this, but the general understanding at the time when this was added was that "numeric" .paramstyle defines the numbers after the colon as referring to 1-based positions in the parameter tuple (otherwise, binding the same value multiple times would not work, which is the main "feature" of the numeric style). The only DB-API compatible module I know which does implement this, is the old Informix one: https://informixdb.sourceforge.net/manual.html#binding-parameters > OTOH, if we did not expect the numbers to be significant, and they are > basically more interesting looking question marks where we dont care > about the number, we'd expect this to match: > > cursor.execute( > ??? """select count(*) from my_table where a=:3 and b=:4 and c=:1 and > d=:5 and e=:2""", > ??? ("a", "b", "c", "d", "e"), > ) > > Apparently Python sqlite3 module, which has been in production for > decades at this point in billions of computers, seems to honor the > second form, and an issue search has not shown anyone ever noticing.? > I've raised an issue at https://github.com/python/cpython/issues/99953 > > It would appear this might speak to the relative un-popularity of > "numeric" paramstyle, though that doesn't change my own process here, > which is to try to support it. The sqlite3 docs have this to say (https://docs.python.org/3/library/sqlite3.html#sqlite3.paramstyle): sqlite3.paramstyle String constant stating the type of parameter marker formatting expected by the |sqlite3| module. Required by the DB-API. Hard-coded to |"qmark"|. Note The |sqlite3| module supports |qmark|, |numeric|, and |named| DB-API parameter styles, because that is what the underlying SQLite library supports. However, the DB-API does not allow multiple values for the |paramstyle| attribute. I've never seen sqlite3 used with numeric style binding parameters. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Dec 02 2022) >>> Python Projects, Coaching and Support ... https://www.egenix.com/ >>> Python Product Development ... https://consulting.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike_mp at zzzcomputing.com Fri Dec 2 12:38:58 2022 From: mike_mp at zzzcomputing.com (Mike Bayer) Date: Fri, 02 Dec 2022 12:38:58 -0500 Subject: [DB-SIG] intent of "numeric" paramstyle, wrt actual numbers not numerically ordered? In-Reply-To: <5bec489c-fc82-3cf5-76b6-6eb6fbbdfb64@egenix.com> References: <4b76f98d-0097-4951-bae0-ec30688afff3@app.fastmail.com> <5bec489c-fc82-3cf5-76b6-6eb6fbbdfb64@egenix.com> Message-ID: On Fri, Dec 2, 2022, at 12:14 PM, Marc-Andre Lemburg wrote: > On 02.12.2022 17:34, Mike Bayer wrote: >> Does numeric paramstyle intend to support statements where the numbers are not numerically ordered within the statement? For example: >> >> select count(*) from my_table where a=:3 and b=:4 and c=:1 and d=:5 and e=:2 >> >> >> if so, what is the expected form of the positional tuple? Consider this data: >> >> insert into my_table(a, b, c, d, e) values ('a', 'b', 'c', 'd', 'e') >> >> to match this row, if we assume the positional tuple's contents should correspond to the numbers in the statement assuming 1-based ordering, we would expect this statement to match the row: >> >> cursor.execute( >> """select count(*) from my_table where a=:3 and b=:4 and c=:1 and d=:5 and e=:2""", >> ("c", "e", "a", "b", "d") >> ) >> > PEP 249 is a bit vague on this, but the general understanding at the time when this was added was that "numeric" .paramstyle defines the numbers after the colon as referring to 1-based positions in the parameter tuple (otherwise, binding the same value multiple times would not work, which is the main "feature" of the numeric style). > thanks, that confirms what I thought, for our own testing we will test with that style. I'm supplying a Connection subclass for our tests that use SQLite just for testing numeric format, which fixes the parameters into something it expects, which is, just a dictionary with those numbers as names, since it supports "named" format too. > The only DB-API compatible module I know which does implement this, is the old Informix one: https://informixdb.sourceforge.net/manual.html#binding-parameters > on our end we are adapting some non-DB-API modules like asyncpg to DB-API, or something very close to that. asyncpg uses PostgreSQL's native bound format which is "numbered" with dollar signs instead of colons. as long as "numbered" is in pep-249 there's always the chance that some other new database will rely upon it... >> The sqlite3 docs have this to say (https://docs.python.org/3/library/sqlite3.html#sqlite3.paramstyle): > sqlite3.paramstyle > String constant stating the type of parameter marker formatting expected by the `sqlite3` module. Required by the DB-API. Hard-coded to `"qmark"`. > > Note > > The `sqlite3` module supports `qmark`, `numeric`, and `named` DB-API parameter styles, because that is what the underlying SQLite library supports. However, the DB-API does not allow multiple values for the `paramstyle` attribute. > I don't understand what they mean by "the DB-API does not allow multiple values for the paramstyle attribute", unless they meant, it's not a tuple of all possible types. SQLite supports statements with any of those formats (with the exception of this issue). I'm not sure if I'm recalling correctly but it seems like some DBAPIs want you to actually assign to .paramstyle to change the paramstyle in use (seems safer than just auto-detecting). > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the Experts (#1, Dec 02 2022) > >>> Python Projects, Coaching and Support ... https://www.egenix.com/ > >>> Python Product Development ... https://consulting.egenix.com/ > ________________________________________________________________________ > > ::: We implement business ideas - efficiently in both time and costs ::: > > eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 > D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg > Registered at Amtsgericht Duesseldorf: HRB 46611 > https://www.egenix.com/company/contact/ > https://www.malemburg.com/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mal at egenix.com Fri Dec 2 12:56:54 2022 From: mal at egenix.com (Marc-Andre Lemburg) Date: Fri, 2 Dec 2022 18:56:54 +0100 Subject: [DB-SIG] intent of "numeric" paramstyle, wrt actual numbers not numerically ordered? In-Reply-To: References: <4b76f98d-0097-4951-bae0-ec30688afff3@app.fastmail.com> <5bec489c-fc82-3cf5-76b6-6eb6fbbdfb64@egenix.com> Message-ID: <58fad19b-8408-28a4-fed3-5630a59d0b89@egenix.com> On 02.12.2022 18:32, John Stevenson - BGS wrote: > > The documents officially state ?named? as the paramstyle, but with > cx_Oracle we often use the numeric style with executemany so that we > can insert from lists of tuples.? In this context, the useful > ?feature? of the numeric paramstyle is that you don?t need to > transform your data into a dictionary. > > https://cx-oracle.readthedocs.io/en/latest/api_manual/module.html#cx_Oracle.paramstyle > > I haven?t tried binding the same value multiple times or using the > placeholders in different orders, though. > cx_Oracle seems to use "named" style, but simply binds by position when passing in a tuple instead of a dictionary (or keyword args). At least that's what the docs suggest: https://cx-oracle.readthedocs.io/en/latest/user_guide/bind.html I suppose that using "where a=:2 and b=:1" would still bind the first parameter value to "a" and the second to "b". -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Dec 02 2022) >>> Python Projects, Coaching and Support ... https://www.egenix.com/ >>> Python Product Development ... https://consulting.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jostev at bgs.ac.uk Fri Dec 2 12:32:10 2022 From: jostev at bgs.ac.uk (John Stevenson - BGS) Date: Fri, 2 Dec 2022 17:32:10 +0000 Subject: [DB-SIG] intent of "numeric" paramstyle, wrt actual numbers not numerically ordered? In-Reply-To: <5bec489c-fc82-3cf5-76b6-6eb6fbbdfb64@egenix.com> References: <4b76f98d-0097-4951-bae0-ec30688afff3@app.fastmail.com> <5bec489c-fc82-3cf5-76b6-6eb6fbbdfb64@egenix.com> Message-ID: The documents officially state ?named? as the paramstyle, but with cx_Oracle we often use the numeric style with executemany so that we can insert from lists of tuples. In this context, the useful ?feature? of the numeric paramstyle is that you don?t need to transform your data into a dictionary. https://cx-oracle.readthedocs.io/en/latest/api_manual/module.html#cx_Oracle.paramstyle I haven?t tried binding the same value multiple times or using the placeholders in different orders, though. From: DB-SIG On Behalf Of Marc-Andre Lemburg Sent: 02 December 2022 17:14 To: Mike Bayer ; DB-SIG Subject: Re: [DB-SIG] intent of "numeric" paramstyle, wrt actual numbers not numerically ordered? On 02.12.2022 17:34, Mike Bayer wrote: Does numeric paramstyle intend to support statements where the numbers are not numerically ordered within the statement? For example: select count(*) from my_table where a=:3 and b=:4 and c=:1 and d=:5 and e=:2 if so, what is the expected form of the positional tuple? Consider this data: insert into my_table(a, b, c, d, e) values ('a', 'b', 'c', 'd', 'e') to match this row, if we assume the positional tuple's contents should correspond to the numbers in the statement assuming 1-based ordering, we would expect this statement to match the row: cursor.execute( """select count(*) from my_table where a=:3 and b=:4 and c=:1 and d=:5 and e=:2""", ("c", "e", "a", "b", "d") ) PEP 249 is a bit vague on this, but the general understanding at the time when this was added was that "numeric" .paramstyle defines the numbers after the colon as referring to 1-based positions in the parameter tuple (otherwise, binding the same value multiple times would not work, which is the main "feature" of the numeric style). The only DB-API compatible module I know which does implement this, is the old Informix one: https://informixdb.sourceforge.net/manual.html#binding-parameters OTOH, if we did not expect the numbers to be significant, and they are basically more interesting looking question marks where we dont care about the number, we'd expect this to match: cursor.execute( """select count(*) from my_table where a=:3 and b=:4 and c=:1 and d=:5 and e=:2""", ("a", "b", "c", "d", "e"), ) Apparently Python sqlite3 module, which has been in production for decades at this point in billions of computers, seems to honor the second form, and an issue search has not shown anyone ever noticing. I've raised an issue at https://github.com/python/cpython/issues/99953 It would appear this might speak to the relative un-popularity of "numeric" paramstyle, though that doesn't change my own process here, which is to try to support it. The sqlite3 docs have this to say (https://docs.python.org/3/library/sqlite3.html#sqlite3.paramstyle): sqlite3.paramstyle String constant stating the type of parameter marker formatting expected by the sqlite3 module. Required by the DB-API. Hard-coded to "qmark". Note The sqlite3 module supports qmark, numeric, and named DB-API parameter styles, because that is what the underlying SQLite library supports. However, the DB-API does not allow multiple values for the paramstyle attribute. I've never seen sqlite3 used with numeric style binding parameters. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Dec 02 2022) >>> Python Projects, Coaching and Support ... https://www.egenix.com/ >>> Python Product Development ... https://consulting.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/ This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jostev at bgs.ac.uk Fri Dec 2 12:47:46 2022 From: jostev at bgs.ac.uk (John Stevenson - BGS) Date: Fri, 2 Dec 2022 17:47:46 +0000 Subject: [DB-SIG] Typing / Protocol for DBAPI-compatible connections and cursors Message-ID: Hi, Is there a way to do type hints for a generic DBAPI-compatible connection and cursor? Our ETL Helper tool uses cx_Oracle, psycopg2 and sqlite3 connections interchangeably and it would be useful to have a generic type instead explicitly using the classes from each driver. As far as I can see from Google, one way to achieve this would by using Protocols, as defined in PEP 544 (https://peps.python.org/pep-0544/). Is there an "official" PEP 249 DBA API 2.0 protocol anywhere? Thanks, John p.s. ETL Helper is a library we developed to make it easier for our DBAs to use Python to transfer data. https://pypi.org/project/etlhelper/ This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tlocke at tlocke.org.uk Sun Dec 11 05:17:08 2022 From: tlocke at tlocke.org.uk (Tony Locke) Date: Sun, 11 Dec 2022 10:17:08 +0000 Subject: [DB-SIG] intent of "numeric" paramstyle, wrt actual numbers not numerically ordered? In-Reply-To: <58fad19b-8408-28a4-fed3-5630a59d0b89@egenix.com> References: <4b76f98d-0097-4951-bae0-ec30688afff3@app.fastmail.com> <5bec489c-fc82-3cf5-76b6-6eb6fbbdfb64@egenix.com> <58fad19b-8408-28a4-fed3-5630a59d0b89@egenix.com> Message-ID: Sorry I'm a bit late to all of this. Here's what pg8000 does, together with what it sends to PostgreSQL: cursor.execute("SELECT :1, :2", (6, 0)) # Sent to server: "SELECT $1, $2" # Result: ['6', '0'] cursor.execute("SELECT :2, :1", (6, 0)) # Sent to server: "SELECT $2, $1" # Result: ['0', '6'] So the driver pg8000 just replaces ':' with '$' and sends it to the server, and the server uses each numeric as an index into the parameter list, and ignores the order in which the placeholders appear in the statement. On Fri, 2 Dec 2022 at 17:57, Marc-Andre Lemburg wrote: > On 02.12.2022 18:32, John Stevenson - BGS wrote: > > The documents officially state ?named? as the paramstyle, but with > cx_Oracle we often use the numeric style with executemany so that we can > insert from lists of tuples. In this context, the useful ?feature? of the > numeric paramstyle is that you don?t need to transform your data into a > dictionary. > > > > > https://cx-oracle.readthedocs.io/en/latest/api_manual/module.html#cx_Oracle.paramstyle > > > > I haven?t tried binding the same value multiple times or using the > placeholders in different orders, though. > > cx_Oracle seems to use "named" style, but simply binds by position when > passing in a tuple instead of a dictionary (or keyword args). At least > that's what the docs suggest: > > https://cx-oracle.readthedocs.io/en/latest/user_guide/bind.html > > I suppose that using "where a=:2 and b=:1" would still bind the first > parameter value to "a" and the second to "b". > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the Experts (#1, Dec 02 2022) > >>> Python Projects, Coaching and Support ... https://www.egenix.com/ > >>> Python Product Development ... https://consulting.egenix.com/ > ________________________________________________________________________ > > ::: We implement business ideas - efficiently in both time and costs ::: > > eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 > D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg > Registered at Amtsgericht Duesseldorf: HRB 46611 > https://www.egenix.com/company/contact/ > https://www.malemburg.com/ > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > https://mail.python.org/mailman/listinfo/db-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mal at egenix.com Tue Dec 13 04:38:19 2022 From: mal at egenix.com (Marc-Andre Lemburg) Date: Tue, 13 Dec 2022 10:38:19 +0100 Subject: [DB-SIG] intent of "numeric" paramstyle, wrt actual numbers not numerically ordered? In-Reply-To: References: <4b76f98d-0097-4951-bae0-ec30688afff3@app.fastmail.com> <5bec489c-fc82-3cf5-76b6-6eb6fbbdfb64@egenix.com> <58fad19b-8408-28a4-fed3-5630a59d0b89@egenix.com> Message-ID: <5c282d6c-a981-6069-60e2-6695ad6d6611@egenix.com> On 11.12.2022 11:17, Tony Locke wrote: > Sorry I'm a bit late to all of this. Here's what pg8000 does, together > with what it sends to PostgreSQL: > > cursor.execute("SELECT :1, :2", (6, 0)) > # Sent to server: "SELECT $1, $2" > # Result:? ['6', '0'] > > cursor.execute("SELECT :2, :1", (6, 0)) > # Sent to server: "SELECT $2, $1" > # Result: ['0', '6'] > > So the driver pg8000 just replaces ':' with '$' and sends it to the > server, and the server uses each numeric as an index into the parameter > list, and ignores the order in which the placeholders appear in the > statement. Thanks for the added insight. The above is what we had in mind with the numeric binding type, even though it is not explicitly spelled out in PEP 249. Perhaps I ought to add a footnote to the PEP to explain the mode in more detail. > On Fri, 2 Dec 2022 at 17:57, Marc-Andre Lemburg > wrote: > > On 02.12.2022 18:32, John Stevenson - BGS wrote: >> >> The documents officially state ?named? as the paramstyle, but with >> cx_Oracle we often use the numeric style with executemany so that >> we can insert from lists of tuples.? In this context, the useful >> ?feature? of the numeric paramstyle is that you don?t need to >> transform your data into a dictionary. >> >> https://cx-oracle.readthedocs.io/en/latest/api_manual/module.html#cx_Oracle.paramstyle >> >> I haven?t tried binding the same value multiple times or using the >> placeholders in different orders, though. >> > cx_Oracle seems to use "named" style, but simply binds by position > when passing in a tuple instead of a dictionary (or keyword args). > At least that's what the docs suggest: > > https://cx-oracle.readthedocs.io/en/latest/user_guide/bind.html > > > I suppose that using "where a=:2 and b=:1" would still bind the > first parameter value to "a" and the second to "b". > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the Experts (#1, Dec 02 2022) > >>> Python Projects, Coaching and Support ... https://www.egenix.com/ > >>> Python Product Development ... https://consulting.egenix.com/ > ________________________________________________________________________ > > ::: We implement business ideas - efficiently in both time and costs ::: > > eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 > D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg > Registered at Amtsgericht Duesseldorf: HRB 46611 > https://www.egenix.com/company/contact/ > https://www.malemburg.com/ > > _______________________________________________ > DB-SIG maillist? - DB-SIG at python.org > https://mail.python.org/mailman/listinfo/db-sig > > > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > https://mail.python.org/mailman/listinfo/db-sig -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Dec 13 2022) >>> Python Projects, Coaching and Support ... https://www.egenix.com/ >>> Python Product Development ... https://consulting.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/ From phd at phdru.name Thu Dec 22 11:42:37 2022 From: phd at phdru.name (Oleg Broytman) Date: Thu, 22 Dec 2022 19:42:37 +0300 Subject: [DB-SIG] SQLObject 3.10.1 Message-ID: Hello! I'm pleased to announce version 3.10.1, the first minor feature release of branch 3.10 of SQLObject. What's new in SQLObject ======================= Minor features -------------- * Use ``module_loader.exec_module(module_loader.create_module())`` instead of ``module_loader.load_module()`` when available. Drivers ------- * Added ``mysql-connector-python``. Tests ----- * Run tests with Python 3.11. CI -- * Ubuntu >= 22 and ``setup-python`` dropped Pythons < 3.7. Use ``conda`` via ``s-weigand/setup-conda`` instead of ``setup-python`` to install older Pythons on Linux. For a more complete list, please see the news: http://sqlobject.org/News.html What is SQLObject ================= SQLObject is a free and open-source (LGPL) Python object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL/MariaDB (with a number of DB API drivers: ``MySQLdb``, ``mysqlclient``, ``mysql-connector``, ``PyMySQL``, ``mariadb``), PostgreSQL (``psycopg2``, ``PyGreSQL``, partially ``pg8000`` and ``py-postgresql``), SQLite (builtin ``sqlite``, ``pysqlite``, partially ``supersqlite``); connections to other backends - Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB) - are less debugged). Python 2.7 or 3.4+ is required. Where is SQLObject ================== Site: http://sqlobject.org Download: https://pypi.org/project/SQLObject/3.10.1 News and changes: http://sqlobject.org/News.html StackOverflow: https://stackoverflow.com/questions/tagged/sqlobject Mailing lists: https://sourceforge.net/p/sqlobject/mailman/ Development: http://sqlobject.org/devel/ Developer Guide: http://sqlobject.org/DeveloperGuide.html Example ======= Install:: $ pip install sqlobject Create a simple class that wraps a table:: >>> from sqlobject import * >>> >>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:') >>> >>> class Person(SQLObject): ... fname = StringCol() ... mi = StringCol(length=1, default=None) ... lname = StringCol() ... >>> Person.createTable() Use the object:: >>> p = Person(fname="John", lname="Doe") >>> p >>> p.fname 'John' >>> p.mi = 'Q' >>> p2 = Person.get(1) >>> p2 >>> p is p2 True Queries:: >>> p3 = Person.selectBy(lname="Doe")[0] >>> p3 >>> pc = Person.select(Person.q.lname=="Doe").count() >>> pc 1 Oleg. -- Oleg Broytman https://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN.