Commit Graph

74 Commits

Author SHA1 Message Date
Dave Page
f221194bcc Update copyright notices for 2017. 2017-01-04 13:33:32 +00:00
Dave Page
ca333ea6a7 Don't strip \r\n from "Download as CSV" batches of rows, as it leads to malformed data. Fixes #1936 2016-11-07 14:47:50 +00:00
Murtuza Zabuawala
bde3dd845b Fix SSL setup. Fixes #1817 2016-10-05 13:05:10 +01:00
Ashesh Vashi
09c2d605c9 Prevent bigints getting rounded. Fixes #1547 2016-09-26 15:51:01 +01:00
Harshal Dhumal
f117685d77 Drop all connections from the connection manager when a server is dropped to avoid issues if sqlite reuses an ID. Fixes #1720 2016-09-22 12:57:52 +01:00
Surinder Kumar
28ce31a022 Save error details when executing to CSV, if no data is returned. This ensures the user gets some feedback rather than nothing at all. Fixes #1592 2016-09-20 11:57:51 +01:00
Murtuza Zabuawala
881d2a60a4 Fix an exception that could occur when the browser pings the server following a restart. Fixes #1707 2016-09-19 15:57:52 +01:00
Murtuza Zabuawala
42e19d2169 Fix error highlighting, broken in d6391c7e9b. Fixes #1676 2016-09-09 14:45:03 +01:00
Surinder Kumar
da21cabb1e Fix typo in connection handler. 2016-09-07 14:01:56 +01:00
Murtuza Zabuawala
679ad6fca8 Support range types in the query tool. Fixes #1658 2016-09-06 14:26:43 +01:00
Murtuza Zabuawala
1b75679ec4 Python 2.6 fixes. Fixes #1636. Fixes #1659 2016-09-06 14:07:30 +01:00
Ashesh Vashi
8ac65070bc Improve the logic for Bad handling of missing connection database server RM #1387 2016-09-06 15:35:20 +05:30
Ashesh Vashi
f12d981a9d Handling the bad/lost connection of a database server.
Made backend changes for:
* Taking care of the connection status in the psycopg2 driver. And, when
  the connection is lost, it throws a exception with 503 http status
  message, and connection lost information in it.
* Allowing the flask application to propagate the exceptions even in the
  release mode.
* Utilising the existing password (while reconnection, if not
  disconnected explicitly).
* Introduced a new ajax response message 'service_unavailable' (http
  status code: 503), which suggests temporary service unavailable.

Client (front-end) changes:
* To handle the connection lost of a database server for different
  operations by generating proper events, and handle them properly.

Removed the connection status check code from different nodes, so that
- it generates the proper exception, when accessing the non-alive
  connection.

Fixes #1387
2016-08-29 12:01:35 +05:30
Murtuza Zabuawala
d6391c7e9b Properly display messages from the server in the query tool. Fixes #1523 2016-08-18 17:08:40 +01:00
Murtuza Zabuawala
01252a13cf Further misc quoting/encoding related fixes. 2016-08-01 15:23:06 +01:00
Murtuza Zabuawala
06e881570a Fix numerous encoding issues. Fixes #1307. Fixes #1479 2016-07-26 15:05:14 +01:00
Dave Page
60659975ed Stop using deprecated imports. 2016-07-22 16:25:23 +01:00
Ashesh Vashi
8b35a60c08 Generate the proper unique name for the duplicate column name.
Thanks Murtuza for reporting the issue.
2016-07-19 11:27:03 +05:30
Harshal Dhumal
83a1535f89 Fix saving of query output as CSV data. Fixes #1405 2016-07-18 15:29:09 +01:00
Murtuza Zabuawala
5560d5b334 Properly support the interval type. Fixes #1437 2016-07-18 09:40:45 +01:00
Ashesh Vashi
9ba6bafb2b Using own version of cursor class to allow us to take care of the
duplicate name in column description.
2016-07-16 10:42:51 +05:30
Dave Page
7d0fe669ca Code tidy. 2016-06-21 14:21:06 +01:00
Dave Page
3026b470e9 Optimise Python imports. 2016-06-21 14:12:14 +01:00
Ashesh Vashi
fc295f94a3 Remove recusive call of _wait_timeout() due to which python server is crashing 2016-06-16 17:49:02 +05:30
Murtuza Zabuawala
a800b19c87 Fix display of NaN and Bytea data. Fixes #1350. Fixes #1309 2016-06-16 11:20:00 +01:00
Surinder Kumar
5dbbd8e638 Resolve problem displaying intervals and timestamps. Fixes #1352
1) No handling for INTERVAL type datetime.
For example: executing query
SELECT INTERVAL '15 minutes';
throws json serialization error, because it returns time in timedelta format which is not handled.

Added support to handle timedelta datetime format in DataTypeJSONEncoder class

2) When we try to get BC dates from database raises ValueError: year is out of range
For eg:
SELECT TIMESTAMP '0044-03-15 10:00:00 BC',
It is because pyscopg2 doesn't handle BC datetime format.

So we have defined our method which type cast the datetime value to string in pyscopg2 overriding default behaviour.

Reference:
http://initd.org/psycopg/docs/advanced.html#type-casting-from-sql-to-python
ccf3693be6/pgcli/pgexecute.py
2016-06-14 17:09:47 +01:00
Ashesh Vashi
7d08e42bbe During encryption password is converted to buffer (instead of
bytearray), and that is causing the issue in Python 2.

This was regress of commit-id: 37e2e1d24b
2016-06-07 13:26:43 +05:30
Ashesh Vashi
37e2e1d24b Fixing the decryption issue during restoring the connection on restart.
As we convert the binary password to string during storing the
connection information, we also need to convert it back to byte-arrays
during restoring the connections.

Hence - decode the passowrd using 'utf-8' encoding during storing the
connection information, and encode it during restoring the connections.
2016-06-06 22:48:53 +05:30
Ashesh Vashi
ca62825c90 Set PGPASSWORD environment variable from the process executor before running
the external utility.
2016-05-15 22:29:17 +05:30
Harshal Dhumal
14839bf5de Always make sure - we convert the psasword to string in the as_dict
function.
2016-05-14 01:14:26 +05:30
Ashesh Vashi
b22d73ec46 Improvise the pgsql driver to keep the utility names used for different
operation like backup, restore, etc within it.

Also:
* improvised the color combination of the background process logger.
* Removed an unnecessary print statement from the
  get_storage_directory(..) function, also return None if STORAGE_DIR
  is set to None.
2016-05-14 00:48:20 +05:30
Ashesh Vashi
7f790a7f49 Use the same cursor object of a connection object only from the same
server.

Current implementation keeps the cursor object in the 'g' (current
request context) object identified by the connection-id.
But - it fails to identify a different connection object request, when
we have same database name in different database server, it does not
able to identify it as separate request, Hence - now we will use
server-id qualified identifier for the same object.

Thanks Neel Patel for pointing out the issue.
2016-05-12 13:08:38 +05:30
Karen Blatchley
949e536bae First round of string review and cleanup. 2016-05-06 13:53:48 +01:00
Ashesh Vashi
26e9ceaf48 Do not reset the driver registry when the 'load_driver' method of
DriverRegistry is executed second time.

Also, initialize the driver before registering different blueprints,
which uses those driver inside them.

Thanks Khushboo for reporting the issue.
2016-04-25 15:33:54 +05:30
Akshay Joshi
03d6fce53c Add support for an affected row count property to the DB interface. 2016-04-12 17:02:54 +01:00
Ashesh Vashi
c304d3e90e Save the database OID of the maintenance database. 2016-04-11 17:15:55 +05:30
Neel Patel
e585ddbdaf Improvise the PostgreSQL driver to fetch the status message.
At the moment, we will only allow to fetch status messages from the
asynchronous connection only, later - we may implement to fetch the
status message from the normal connection too.
2016-04-05 13:29:20 +05:30
Akshay Joshi
5331075ab0 Improvise the psycopg2 wrapped driver for PostgreSQL to show formatted
message on demand.

Also - resolved an issue identifying the aborted transaction while using
the asychronous connection.
2016-04-04 12:29:43 +05:30
Ashesh Vashi
b3c625f135 Graceful server reconnections. 2016-03-22 15:35:11 +00:00
Neel Patel
ff424850f8 Fix a bug in the database drive poll() function where we could try to reference a non-existant variable. 2016-03-15 13:01:28 +00:00
Akshay Joshi
f08aa6a313 Always fetch column info from the server, even if there are no rows. 2016-03-08 15:59:53 +00:00
Dave Page
5ea822f33e Preferences dialogue. Patch by Ashesh and Khushboo Vashi. 2016-03-07 11:48:53 +00:00
Neel Patel
31ab9ebacc Using the correct member variable while fetching the notices/messages
from the psycopg2 connection.
2016-03-06 18:56:42 +05:30
Ashesh Vashi
0b43443151 Allow the connection driver to return notices/messages from the server. 2016-03-04 10:35:50 +00:00
Akshay Joshi
e138ec53b6 Add support for asynchronous connections to the database server. 2016-03-02 13:29:15 +00:00
Ashesh Vashi
c3b0e1dec4 Returns an error when the driver couldn't decrypt the password, and
let the user know the issue.
2016-02-22 14:03:07 +05:30
Ashesh Vashi
d5da26876b Resolved few issues (with some improvements) with existing nodes.
This commit takes care of the following issues/improvements.
* Adding missing imports for unauthorised in database module
* Node under Servers Nodes (i.e. Databases, tablespaces, roles nodes)
  need to be inherited from PGChildNodeView (and, not from NodeView) for
  adding server version check for their children.
* Adding statistics for database, and tablespaces in its node (not, yet
  in UI)
* Renaming the camel case methods with proper name.
  (i.e. getSQL -> get_sql, getNewSQL -> get_new_sql, etc.)
* Fixed the functions going beyond the text limit (column: 80) in
  Databases, Roles & Tablespaces modules.
* Fixed the node method of Database module, which was not tested ever.
* We do not need separate SQL template for fetching the name (i.e.
  get_name.sql), using the 'nodes.sql' for the same.
* Optimise the query for fetching ACLs for the database node, we didn't
  require to join certain tables, while fetching only the ACLs.
* Introduced the list of the ACLs (regular and default ACLs for
  different type) supported by each version [Databases Module].
* Renamed the templates 'get_nodes.sql' to' nodes.sql' to make it
  consistent with other modules.
* Removed the checks for the authentication table use, as we don't need
  to expose the password to the users (even the encrypted MD5). Using
  the pg_roles view always for fetching roles/users information now.
* Resolved some typos in unreachable (specially the exceptions
  catchment area.)
* Logging the exception in the application.
* Using qtLiteral, qtIdent properly in the templates (do not assume
  about the types of data.)
* Using tsid as identifier instead of did for the tablespaces.
* Using nodes method of tablespace view for fetching individual node
  information.
* Removing the hardcoded node information from the 'parse_priv_to_db'
  function, and pass on allowed ACLs by the caller nodes.
* Using 'nodes.sql' to fetch name of the template instead of writing
  that in the delete.sql template, which is definitely wrong place to
  fetch the name of the object. [Tablespace Module]
2016-02-22 11:44:24 +05:30
Ashesh Vashi
639a3ed0ac Fixes the qtIdent function in the psycopg2 driver about not taking care
of double quote within it.

The 'replace' function of immutable type string do create a new
instance of type string, which needed to be reassgined to the variable
'value'.

Reported By: Murtuza Zabuawala
2016-02-10 15:00:52 +05:30
Ashesh Vashi
3ca29b18b5 Resolved an issue related to quoting the wrong keywords for the types.
It was due to wrong index used for the COL_NAME_KEYWORD, used by the
'needsQuoting' function.

Also, replaced a tab with a space in the generate_keyword.py file.

Reported by: Sanket Mehta, Khushboo Vashi
2016-02-05 10:15:23 +05:30
Harshal Dhumal
b77c5a6c54 Python 2.6 support fixes. 2016-01-27 15:59:54 +01:00