Giter VIP home page Giter VIP logo

dbmanagr's Introduction

Database Managr

Latest PyPI version Number of PyPI downloads Build Status Coverage Status

Allows you to explore, visualise, and export your database recursively. Additionally allows to explore the database using the Powerpack of Alfred 2.0.

Database Grapher Example

Main Features

  • Database Navigation
  • Database Visualisation
  • Database Export
  • Database Execution
  • Database Diff
  • Supported databases: PostgreSQL, MySQL, SQLite
  • Use database connection definitions from
    • the ~/.pgpass configuration file (PGAdmin)
    • the ~/.mypass configuration file (like ~/.pgpass)
    • the ~/.dbexplorer/dbexplorer.cfg configuration file (DBExplorer)
    • the Navicat configuration file (SQLite)

Database Navigation

Documentation: Navigator wiki page

Database Navigator Example

Features

  • Shows databases of configured connections
  • Shows tables of databases
  • Shows columns of tables for restricting rows
  • Shows rows of tables with multiple restrictions (operators: =, !=, >, <, >=, <=, like, in)
  • Shows detailed row information
  • Shows info of foreign table row (based on the foreign key)
  • Switch to the foreign table row (forward references)
  • Shows foreign keys that point to the current table row (back references)
  • Configuration of what is shown based on table comments (currently PostgreSQL only)

Database Visualisation

Visualises the dependencies of a table using its foreign key references (forward and back references).

Documentation: Grapher wiki page

Database Grapher Example

Features

  • Optionally display columns as well as references
  • Highlights primary keys (*) and optional columns (?)
  • Optionally include or exclude columns/dependencies from the graph
  • Optionally enable recursive inclusion (outputs each table only once, so cycles are not an issue)
  • Ouput formats include hierarchical text and a Graphviz directed graph
  • Uses the same configuration and URI patterns as the Database Navigator

Database Exporter

Exports specific rows from the database along with their references rows from other tables.

Documentation: Exporter wiki page

Database Exporter Example

Features

  • Exports the rows matching the given URI as SQL insert statements
  • Allows inclusion of referenced tables (forward and back references)
  • Allows exclusion of specific columns (useful if columns are optional, or cyclic references exist)
  • Takes into account the ordering of the statements (when table A references table B, then the referenced row from B must be inserted first)
  • Limits the number of returned rows of the main query (does not limit referenced rows)

Database Executer

Executes the SQL statements from the given file on the database specified by the given URI.

Documentation: Executer wiki page

Database Executer Example

Database Differ

A diff tool that compares the structure of two database tables with each other.

Documentation: Differ wiki page

Database Differ Example

Installation

Installing using PIP also upgrades to the latest version:

sudo pip install --upgrade git+https://github.com/resamsel/dbmanagr.git#egg=dbnav

You might want to install database drivers for PostgreSQL and MySQL as well:

sudo pip install pg8000 pymysql

More information and installation options can be found on the Installation wiki page.

Configuration

Configuration of connections is described in the Connection Configuration wiki page.

Configuration of content is described in the Content Configuration wiki page.

Development

More information can be found on the Development wiki page.

dbmanagr's People

Contributors

resamsel avatar

Stargazers

nodojo avatar  avatar Peter Spiess-Knafl avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

gschaden

dbmanagr's Issues

dbexport throws ordinal not in range error

Using the YAML output fails for non ascii characters.

dbexport user@livecopy/database/competition?link_name=Swisscom_Snow_Cup -i competition_definition,competition_definition.competition_instance.safari_route_id.user_2_route -Y

Actual

dbexport: 'ascii' codec can't encode characters in position 47-48: ordinal not in range(128)

Expected

<YAML>

Exporter creates Update statements without PK-restriction

Even in the the simplest case, which means that I'm exporting only one table without references, the Exporter does not include a restriction in the update statement.

E.g. the given statement is:

update section set s_id = 3824, id = 131055131155, duration = 200, length = 600 [...] where ;

instead of

update section set id = 131055131155, duration = 200, length = 600 [...] where s_id=3824;

Exporter creates statements with NULL values only

When updating SQLAlchemy to a a version >= 1.0.8, dbexporter has NULL values only, in its generated statements.
The error can be mitigated by downgrading to an older version of SQLAlchemy.
The changelog (http://docs.sqlalchemy.org/en/latest/changelog/changelog_10.html) states that the query result class uses slots instead of dict now.
There are various locations throughout the code, where either dict is used, or at least these objects are treated as dictionaries.

Add Daemon Mode

Add a --daemon option that works similar to the Gradle --daemon option. The daemon should stay connected to the database for a few seconds or minutes, allowing to reuse the connection and gathered information from reflecting the database.

It could work that way:

When the option is set, use a separate DaemonDatabaseConnection (DDC) instead of the specific database connection. The DDC should then start the daemon (if not already running), connect to it, and use that daemon to execute the statements.

The daemon needs a separate writer that writes to a socket instead of stdout. It should also behave as a web server, the transport layer should be JSON (easy to debug with Postman, SoapUI, ...).

allow placeholder for original value in -s

i would like to use placeholders in the -s option to reference the original value.

| id | name | value |
| 123456 | Berti Bauer | 3 |

-s value="myFunction('{value}')"

or even other column values:

-s value="myFunction('{id}')"

UTF-8 issue

Calling the following leads to an error:

dbnav skiline@localhost/skiline/spot?name~%nigs%

Error:

dbnav: 'ascii' codec can't encode character u'\xf6' in position 1: ordinal not in range(128)

dbexec: 'str' object has no attribute 'close'

Command:

echo "update chip_number_to_external_id_mapping set valid_from = ski_date, valid_until = ski_date where valid_from is null and valid_until is null and ski_date is not null and ski_date < '2015-09-02';" | dbexec skiline@localhost/skiline_test

Result:

dbexec: 'str' object has no attribute 'close'

Expected:

Changed rows: 217326

dbexport with -D should delete in reverse order

The exporter should reverse the order of the delete statements, i.e. delete article before deleting user.

dbexport -D dbnav.sqlite/article?id=1 -i user_id

Actual

delete from "user" where id = 558;
delete from article where id = 1;

Expected

delete from article where id = 1;
delete from "user" where id = 558;

Improve error messages if no database connector is configured

Steps for reproduction:

  • Install on a system without python database connector(s) but existing postgres connection configuration (.pgpass)
  • execute dbexport user@connection/database/table
  • Error message is "Specify the complete URI to a table"

Error message should be: "It was not possible to connect to the database. If the connection is not among the following connections, please install connector (see [location of description]):
[list of connection]

Cache result of expensive metadata retrieval

The part that takes longest in executing is retrieving metadata from the database. The result should be cached, and the cache should not expire.

Additionally, add a CLI parameter to refresh the cache (--refresh-cache, invalidates cache and forces reload of metadata), and another to disable caching at all (--disable-cache, does not invalidate cache).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.