From a0cb6b27e2a06c4235649e0975ae9beecb2cbb72 Mon Sep 17 00:00:00 2001 From: blackinv1 <30832934+blackinv1@users.noreply.github.com> Date: Tue, 4 Aug 2020 09:26:45 +1000 Subject: [PATCH] Update README.rst Update the README jaydebeapi.connect() method examples to proper use named arguments. The current examples are WRONG, and they are very misleading. --- README.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 21a3523..9fd1bf5 100644 --- a/README.rst +++ b/README.rst @@ -91,8 +91,8 @@ Here is an example: >>> import jaydebeapi >>> conn = jaydebeapi.connect("org.hsqldb.jdbcDriver", ... "jdbc:hsqldb:mem:.", -... ["SA", ""], -... "/path/to/hsqldb.jar",) +... driver_args=["SA", ""], +... jars="/path/to/hsqldb.jar",) >>> curs = conn.cursor() >>> curs.execute('create table CUSTOMER' ... '("CUST_ID" INTEGER not null,' @@ -117,16 +117,16 @@ properties: >>> conn = jaydebeapi.connect("org.hsqldb.jdbcDriver", ... "jdbc:hsqldb:mem:.", -... {'user': "SA", 'password': "", +... driver_args={'user': "SA", 'password': "", ... 'other_property': "foobar"}, -... "/path/to/hsqldb.jar",) +... jars="/path/to/hsqldb.jar",) Also using the ``with`` statement might be handy: >>> with jaydebeapi.connect("org.hsqldb.jdbcDriver", ... "jdbc:hsqldb:mem:.", -... ["SA", ""], -... "/path/to/hsqldb.jar",) as conn: +... driver_args=["SA", ""], +... jars="/path/to/hsqldb.jar",) as conn: ... with conn.cursor() as curs: ... curs.execute("select count(*) from CUSTOMER") ... curs.fetchall()