Package: odbcli
odbc-cliPlease note: this package should be considered "alpha" - while you are more than welcome to use it, you should expect that getting it to work for you will require quite a bit of self-help on your part.  At the same time, it may be a great opportunity for those that want to contribute.odbc-cliis an interactive command line query tool intended to work for DataBase Management Systems (DBMS) supported by ODBC drivers.As is the case with theremaining clientsderived from thepython prompt toolkit library,odbc-clialso supports a rich interactive command line experience, with features such as auto-completion, syntax-highlighting, multi-line queries, and query-history.Beyond these, some distinguishing features ofodbc-cliare:Multi DBMS support:  In addition to supporting connections to multiple DBMS, withodbc-cliyou can connect to, and query multiple databases in the same session.An integrated object browser: Navigate between connections and objects within a database.Small footprint and excellent performance: One of the main motivations is to reduce both the on-disk, as well as in-memory footprint of theexisting Microsoft SQL Server client, while at the same time improve query execution, and time spent retrieving results.Out-of-database auto-completion: Mostly relevant to SQL Server users, but auto-completion is "aware" of schema and table structure outside of the currently connected catalog / database.Installing and OS supportThe assumption is that the starting point is a box with a working ODBC setup.  This means a driver manager (UnixODBC, for example), together with ODBC drivers that are appropriate to the DBM Systems you intend to connect to.To install the latest version of the package marked asstable, simply:python-mpipinstallodbcliDevelopmentversions, tracking the tip of the master branch, are hosted on Test Pypi, and can be installed, for example by:python-mpipinstall--index-urlhttps://test.pypi.org/simple/odbcliNotes:In theory, this package should work under Windows, MacOS, as well as Linux.  I can only test Linux; help testing and developing on the other platforms (as well as Linux) is very much welcome.The main supporting package,cyanodbccomes as a pre-compiled wheel.  It requires a modern C++ library supporting the C++14 standard.  The cyanodbc Linux wheel is built on Ubuntu 16 - not exactly bleeding edge.  Anything newer should be fine.As ofhttps://github.com/detule/odbc-cli/commit/bea22885d0483de0c1899ebc26ff853568b0e417,odbc-clirequirescyanodbcversion0.0.2.136or newer.UsageSee theUsage section here.Supported DBMSI have had a chance to test connectivity and basic functionality to the following DBM Systems:Microsoft SQL ServerSupport and usability here should be furthest along.  While I encounter (and fix) an occasional issue, I use this client in this capacity daily.Driver notes:OEM Driver: No known issues (I test with driver version 17.5).FreeTDS: Please use version 1.2 or newer for optimal performance (older versions do not support the SQLColumns API endpoint applied to tables out-of-currently-connected-catalog).MySQLI have had a chance to test connectivity and basic functionality, but contributor help very much appreciated.SQLiteI have had a chance to test connectivity and basic functionality, but contributor help very much appreciated.PostgreSQLI have had a chance to test connectivity and basic functionality, but contributor help very much appreciated.Driver notes:Please consider usingpsqlODBC 12.01or newer for optimal performance (older versions, when used with a PostgreSQL 12.0, seem to have a documented bug when calling into SQLColumns).SnowflakeI have had a chance to test connectivity and basic functionality, but contributor help very much appreciated.Driver notes:As of version 2.20 of their ODBC driver, consider specifying theDatabasefield in the DSN configuration section in your INI files.  If noDatabaseis specified when connecting, their driver will report the empty string - despite being attached to a particlar catalog.  Subsequently, post-connection specifying the database usingUSEworks as expected.OtherDMB Systems with ODBC drivers not mentioned above should work with minimal, or hopefully no additional, configuration / effort.Reporting issuesThe best feature - multi DBMS support, is also a curse from a support perspective, as there are too-many-to-count combinations of:Client platform (ex: Debian 10)Data base system (ex: SQL Server)Data base version (ex: 19)ODBC driver manager (ex: unixODBC)ODBC driver manager version (ex: 2.3.x)ODBC driver (ex: FreeTDS)ODBC driver version (ex: 1.2.3)that could be specific to your setup, contributing to the problem and making it difficult to replicate.  Please consider including all of this information when reporting the issue, but above all be prepared that I may not be able to replicate and fix your issue (and therefore, hopefully you can contribute / code-up a solution).  Since the use case for this client is so broad, the only way I see this project having decent support is if we build up a critical mass of user/developers.TroubleshootingListing connections and connecting to databasesThe best way to resolve connectivity issues is to work directly in a python console.  In particular, try working directly with thecyanodbcpackage in an interactive session.When starting the client,odbc-cliqueries the driver manager for a list of available connections by executing:import cyanodbc
cyanodbc.datasources()Make sure this command returns a coherent output / agrees with your expectations before attempting anything else.  If it does not, consult the documentaion for your driver manager and make sure all the appropriate INI files are populated accordingly.If for example, you are attempting to connect to a DSN calledpostgresql_db- recall this should be defined and configured in the INI configuration file appropriate to your driver manager, in the background,odbc-cliattempts to establish a connection with a connection string similar to:import cyanodbc
conn = cyanodbc.connect("DSN=postgresql_db;UID=postgres;PWD=password")If experiencing issues connecting to a database, make sure you can establish a connection using the method above, before moving on to troubleshoot other parts of the client.AcknowledgementsThis project would not be possible without the most excellentpython prompt toolkit library.  In addition, idea and code sharing between theclients that leverage this libraryis rampant, and this project is no exception - a big thanks to all thedbclicontributors.