This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SQLObject development repository".
The branch, master has been updated
via e5862d48231274ede862cf06559d2eb9d3d9acf3 (commit)
via 8d8b4ec526b7f74b577c7d69fa6957b8073cb09a (commit)
via 361484195ec9bbe19cdbef400f856554664f6b3b (commit)
via 23b6f30adc2e3e2459271ca32dc2ab265c0b31cd (commit)
via 8679b81f77d1ad5e69add8cd8787d0d3ae87f806 (commit)
from e1b5f794f78ad91dcbe01589994cdb76d5507997 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/e5862d48231274ede862cf06559d2eb9d3d9acf3
commit e5862d48231274ede862cf06559d2eb9d3d9acf3
Merge: e1b5f79 8d8b4ec
Author: Oleg Broytman <ph...@ph...>
Date: Tue Jan 6 04:30:04 2015 +0300
Merge branch '2.1'
http://sourceforge.net/p/sqlobject/sqlobject/ci/8d8b4ec526b7f74b577c7d69fa6957b8073cb09a
commit 8d8b4ec526b7f74b577c7d69fa6957b8073cb09a
Author: Oleg Broytman <ph...@ph...>
Date: Tue Jan 6 04:27:08 2015 +0300
MySQLConnection has got a new method listTables
diff --git a/docs/News.txt b/docs/News.txt
index 48d1163..b51fb96 100644
--- a/docs/News.txt
+++ b/docs/News.txt
@@ -25,7 +25,7 @@ Minor features
a new method listDatabases() that lists databases in the connection
and returns a list of names.
-* PostgresConnection and SQLiteConnection have got
+* MySQLConnection, PostgresConnection and SQLiteConnection have got
a new method listTables() that returns a list of table names in the database.
SQLObject 2.0.0
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index f51eed6..f8e9226 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -297,6 +297,9 @@ class MySQLConnection(DBAPI):
else:
return col.Col, {}
+ def listTables(self):
+ return [v[0] for v in self.queryAll("SHOW TABLES")]
+
def listDatabases(self):
return [v[0] for v in self.queryAll("SHOW DATABASES")]
diff --git a/sqlobject/tests/test_mysql.py b/sqlobject/tests/test_mysql.py
index c22a0ed..394124e 100644
--- a/sqlobject/tests/test_mysql.py
+++ b/sqlobject/tests/test_mysql.py
@@ -1,8 +1,18 @@
from sqlobject import *
from sqlobject.tests.dbtest import *
+class TestSOListMySQL(SQLObject):
+ pass
+
def test_list_databases():
connection = getConnection()
if connection.dbName != "mysql":
return
assert connection.db in connection.listDatabases()
+
+def test_list_tables():
+ connection = getConnection()
+ if connection.dbName != "mysql":
+ return
+ setupClass(TestSOListMySQL)
+ assert TestSOListMySQL.sqlmeta.table in connection.listTables()
http://sourceforge.net/p/sqlobject/sqlobject/ci/361484195ec9bbe19cdbef400f856554664f6b3b
commit 361484195ec9bbe19cdbef400f856554664f6b3b
Author: Oleg Broytman <ph...@ph...>
Date: Tue Jan 6 04:21:30 2015 +0300
PostgresConnection has got a new method listTables
diff --git a/docs/News.txt b/docs/News.txt
index a1ad154..48d1163 100644
--- a/docs/News.txt
+++ b/docs/News.txt
@@ -25,8 +25,8 @@ Minor features
a new method listDatabases() that lists databases in the connection
and returns a list of names.
-* SQLiteConnection has got a new method listTables() that returns a list
- of table names in the database.
+* PostgresConnection and SQLiteConnection have got
+ a new method listTables() that returns a list of table names in the database.
SQLObject 2.0.0
===============
diff --git a/sqlobject/postgres/pgconnection.py b/sqlobject/postgres/pgconnection.py
index 6809ab6..3b91e67 100644
--- a/sqlobject/postgres/pgconnection.py
+++ b/sqlobject/postgres/pgconnection.py
@@ -426,6 +426,14 @@ class PostgresConnection(DBAPI):
cur.close()
conn.close()
+ def listTables(self):
+ return [v[0] for v in self.queryAll(
+ """SELECT c.relname FROM pg_catalog.pg_class c
+ LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
+ WHERE c.relkind IN ('r','') AND
+ n.nspname NOT IN ('pg_catalog', 'pg_toast') AND
+ pg_catalog.pg_table_is_visible(c.oid)""")]
+
def listDatabases(self):
return [v[0] for v in self.queryAll("SELECT datname FROM pg_database")]
diff --git a/sqlobject/tests/test_postgres.py b/sqlobject/tests/test_postgres.py
index abf6674..97ac280 100644
--- a/sqlobject/tests/test_postgres.py
+++ b/sqlobject/tests/test_postgres.py
@@ -1,8 +1,18 @@
from sqlobject import *
from sqlobject.tests.dbtest import *
+class TestSOList(SQLObject):
+ pass
+
def test_list_databases():
connection = getConnection()
if connection.dbName != "postgres":
return
assert connection.db in connection.listDatabases()
+
+def test_list_tables():
+ connection = getConnection()
+ if connection.dbName != "postgres":
+ return
+ setupClass(TestSOList)
+ assert TestSOList.sqlmeta.table in connection.listTables()
http://sourceforge.net/p/sqlobject/sqlobject/ci/23b6f30adc2e3e2459271ca32dc2ab265c0b31cd
commit 23b6f30adc2e3e2459271ca32dc2ab265c0b31cd
Author: Oleg Broytman <ph...@ph...>
Date: Tue Jan 6 04:00:18 2015 +0300
SQLiteConnection has got a new method listTables
diff --git a/docs/News.txt b/docs/News.txt
index 1b15502..a1ad154 100644
--- a/docs/News.txt
+++ b/docs/News.txt
@@ -25,6 +25,9 @@ Minor features
a new method listDatabases() that lists databases in the connection
and returns a list of names.
+* SQLiteConnection has got a new method listTables() that returns a list
+ of table names in the database.
+
SQLObject 2.0.0
===============
diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py
index 90d3f8e..0c28a34 100644
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@ -397,6 +397,10 @@ class SQLiteConnection(DBAPI):
else:
return col.Col, {}
+ def listTables(self):
+ return [v[0] for v in self.queryAll(
+ "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name")]
+
def listDatabases(self):
# The pragma returns a list of (index, name, filename)
return [v[1] for v in self.queryAll("PRAGMA database_list")]
diff --git a/sqlobject/tests/test_sqlite.py b/sqlobject/tests/test_sqlite.py
index 3d5d4a4..9ccdcf4 100644
--- a/sqlobject/tests/test_sqlite.py
+++ b/sqlobject/tests/test_sqlite.py
@@ -123,3 +123,10 @@ def test_list_databases():
if connection.dbName != "sqlite":
return
assert connection.listDatabases() == ['main']
+
+def test_list_tables():
+ connection = getConnection()
+ if connection.dbName != "sqlite":
+ return
+ setupClass(TestSO1)
+ assert TestSO1.sqlmeta.table in connection.listTables()
http://sourceforge.net/p/sqlobject/sqlobject/ci/8679b81f77d1ad5e69add8cd8787d0d3ae87f806
commit 8679b81f77d1ad5e69add8cd8787d0d3ae87f806
Author: Oleg Broytman <ph...@ph...>
Date: Tue Jan 6 03:28:42 2015 +0300
Minor refactoring
Make SQLiteConnection.listDatabases() like other listDatabases'.
diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py
index 452fd1c..90d3f8e 100644
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@ -398,10 +398,8 @@ class SQLiteConnection(DBAPI):
return col.Col, {}
def listDatabases(self):
- results = []
- for index, name, filename in self.queryAll("PRAGMA database_list"):
- results.append(name)
- return results
+ # The pragma returns a list of (index, name, filename)
+ return [v[1] for v in self.queryAll("PRAGMA database_list")]
def createEmptyDatabase(self):
if self._memory:
-----------------------------------------------------------------------
Summary of changes:
docs/News.txt | 3 +++
sqlobject/mysql/mysqlconnection.py | 3 +++
sqlobject/postgres/pgconnection.py | 8 ++++++++
sqlobject/sqlite/sqliteconnection.py | 10 ++++++----
sqlobject/tests/test_mysql.py | 10 ++++++++++
sqlobject/tests/test_postgres.py | 10 ++++++++++
sqlobject/tests/test_sqlite.py | 7 +++++++
7 files changed, 47 insertions(+), 4 deletions(-)
hooks/post-receive
--
SQLObject development repository
|