Quantcast
Channel: Python odbc; how to find all tables in an odbc - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Sylvain Leroux for Python odbc; how to find all tables in an odbc

$
0
0

(the ODBC driver was not specifie at time of this answer)
From PyODBC documentation:

Most of the ODBC catalog functions are available as methods on Cursor objects. The results are presented as SELECT results in rows that are fetched normally. The Cursor page documents these, but it may be helpful to refer to Microsoft's ODBC documentation for more details.

cnxn   = pyodbc.connect(...)cursor = cnxn.cursor()for row in cursor.tables():    print row.table_name

EDIT: as OP specified using "Anaconda ODBC":

As far as I know, there is no direct access to those data from PyWin32-odbc (as I think this is what Anacondas uses). Depending your underlying DB they might be a "system table" that you might query. Something like sys.objects or dbo.sysobjects or information_schema.tables or ... (RDBMS vendors are very creative in that area).

Please see the doc of the underlying RDBMS for more info. Or (as of myself, I would strongly push toward that), file a request to install a more versatile ODBC driver...


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>