mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
pgAdmin4 should work with python 3.7, Fixes #3458
This commit is contained in:
parent
cb8a288f85
commit
52fc0846cd
@ -33,6 +33,7 @@ Bug fixes
|
||||
| `Bug #3446 <https://redmine.postgresql.org/issues/3446>`_ - Various procedure/function related fixes for EPAS/PG 11.
|
||||
| `Bug #3448 <https://redmine.postgresql.org/issues/3448>`_ - Exclude system columns in Import/Export.
|
||||
| `Bug #3457 <https://redmine.postgresql.org/issues/3457>`_ - Fix debugging of procedures in EPAS packages.
|
||||
| `Bug #3458 <https://redmine.postgresql.org/issues/3458>`_ - pgAdmin4 should work with python 3.7.
|
||||
| `Bug #3468 <https://redmine.postgresql.org/issues/3468>`_ - Support SSH tunneling with keys that don't have a passphrase.
|
||||
| `Bug #3471 <https://redmine.postgresql.org/issues/3471>`_ - Ensure the SSH tunnel port number is honoured.
|
||||
| `Bug #3526 <https://redmine.postgresql.org/issues/3526>`_ - COST statement should not be automatically duplicated after creating trigger function.
|
||||
|
@ -1391,7 +1391,7 @@ def start_query_download_tool(trans_id):
|
||||
did=trans_obj.did,
|
||||
conn_id=conn_id,
|
||||
auto_reconnect=False,
|
||||
async=False
|
||||
async_=False
|
||||
)
|
||||
|
||||
sync_conn.connect(autocommit=False)
|
||||
|
@ -149,7 +149,7 @@ class Connection(BaseConnection):
|
||||
- greater than or equal to 10.
|
||||
"""
|
||||
|
||||
def __init__(self, manager, conn_id, db, auto_reconnect=True, async=0,
|
||||
def __init__(self, manager, conn_id, db, auto_reconnect=True, async_=0,
|
||||
use_binary_placeholder=False, array_to_string=False):
|
||||
assert (manager is not None)
|
||||
assert (conn_id is not None)
|
||||
@ -159,7 +159,7 @@ class Connection(BaseConnection):
|
||||
self.db = db if db is not None else manager.db
|
||||
self.conn = None
|
||||
self.auto_reconnect = auto_reconnect
|
||||
self.async = async
|
||||
self.async_ = async_
|
||||
self.__async_cursor = None
|
||||
self.__async_query_id = None
|
||||
self.__backend_pid = None
|
||||
@ -189,7 +189,7 @@ class Connection(BaseConnection):
|
||||
res = dict()
|
||||
res['conn_id'] = self.conn_id
|
||||
res['database'] = self.db
|
||||
res['async'] = self.async
|
||||
res['async_'] = self.async_
|
||||
res['wasConnected'] = self.wasConnected
|
||||
res['auto_reconnect'] = self.auto_reconnect
|
||||
res['use_binary_placeholder'] = self.use_binary_placeholder
|
||||
@ -202,7 +202,7 @@ class Connection(BaseConnection):
|
||||
self.conn_id, self.db,
|
||||
'Connected' if self.conn and not self.conn.closed else
|
||||
"Disconnected",
|
||||
self.async
|
||||
self.async_
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
@ -210,7 +210,7 @@ class Connection(BaseConnection):
|
||||
self.conn_id, self.db,
|
||||
'Connected' if self.conn and not self.conn.closed else
|
||||
"Disconnected",
|
||||
self.async
|
||||
self.async_
|
||||
)
|
||||
|
||||
def connect(self, **kwargs):
|
||||
@ -302,7 +302,7 @@ class Connection(BaseConnection):
|
||||
database=database,
|
||||
user=user,
|
||||
password=password,
|
||||
async=self.async,
|
||||
async_=self.async_,
|
||||
passfile=get_complete_file_path(passfile),
|
||||
sslmode=manager.ssl_mode,
|
||||
sslcert=get_complete_file_path(manager.sslcert),
|
||||
@ -316,7 +316,7 @@ class Connection(BaseConnection):
|
||||
|
||||
# If connection is asynchronous then we will have to wait
|
||||
# until the connection is ready to use.
|
||||
if self.async == 1:
|
||||
if self.async_ == 1:
|
||||
self._wait(pg_conn)
|
||||
|
||||
except psycopg2.Error as e:
|
||||
@ -385,7 +385,7 @@ class Connection(BaseConnection):
|
||||
|
||||
# autocommit flag does not work with asynchronous connections.
|
||||
# By default asynchronous connection runs in autocommit mode.
|
||||
if self.async == 0:
|
||||
if self.async_ == 0:
|
||||
if 'autocommit' in kwargs and kwargs['autocommit'] is False:
|
||||
self.conn.autocommit = False
|
||||
else:
|
||||
@ -641,7 +641,7 @@ WHERE
|
||||
"""
|
||||
This function executes the query using cursor's execute function,
|
||||
but in case of asynchronous connection we need to wait for the
|
||||
transaction to be completed. If self.async is 1 then it is a
|
||||
transaction to be completed. If self.async_ is 1 then it is a
|
||||
blocking call.
|
||||
|
||||
Args:
|
||||
@ -658,7 +658,7 @@ WHERE
|
||||
|
||||
params = self.escape_params_sqlascii(params)
|
||||
cur.execute(query, params)
|
||||
if self.async == 1:
|
||||
if self.async_ == 1:
|
||||
self._wait(cur.connection)
|
||||
|
||||
def execute_on_server_as_csv(self,
|
||||
|
@ -208,6 +208,9 @@ class DictCursor(_cursor):
|
||||
|
||||
def __iter__(self):
|
||||
it = _cursor.__iter__(self)
|
||||
yield self._dict_tuple(next(it))
|
||||
while 1:
|
||||
try:
|
||||
yield self._dict_tuple(next(it))
|
||||
while 1:
|
||||
yield self._dict_tuple(next(it))
|
||||
except StopIteration:
|
||||
pass
|
||||
|
@ -153,7 +153,7 @@ class ServerManager(object):
|
||||
|
||||
def connection(
|
||||
self, database=None, conn_id=None, auto_reconnect=True, did=None,
|
||||
async=None, use_binary_placeholder=False, array_to_string=False
|
||||
async_=None, use_binary_placeholder=False, array_to_string=False
|
||||
):
|
||||
if database is not None:
|
||||
if hasattr(str, 'decode') and \
|
||||
@ -206,12 +206,12 @@ WHERE db.oid = {0}""".format(did))
|
||||
if my_id in self.connections:
|
||||
return self.connections[my_id]
|
||||
else:
|
||||
if async is None:
|
||||
async = 1 if conn_id is not None else 0
|
||||
if async_ is None:
|
||||
async_ = 1 if conn_id is not None else 0
|
||||
else:
|
||||
async = 1 if async is True else 0
|
||||
async_ = 1 if async_ is True else 0
|
||||
self.connections[my_id] = Connection(
|
||||
self, my_id, database, auto_reconnect, async,
|
||||
self, my_id, database, auto_reconnect, async_,
|
||||
use_binary_placeholder=use_binary_placeholder,
|
||||
array_to_string=array_to_string
|
||||
)
|
||||
@ -256,7 +256,7 @@ WHERE db.oid = {0}""".format(did))
|
||||
conn_info = connections[conn_id]
|
||||
conn = self.connections[conn_info['conn_id']] = Connection(
|
||||
self, conn_info['conn_id'], conn_info['database'],
|
||||
conn_info['auto_reconnect'], conn_info['async'],
|
||||
conn_info['auto_reconnect'], conn_info['async_'],
|
||||
use_binary_placeholder=conn_info['use_binary_placeholder'],
|
||||
array_to_string=conn_info['array_to_string']
|
||||
)
|
||||
|
@ -4,13 +4,13 @@ from collections import defaultdict
|
||||
import sqlparse
|
||||
from sqlparse.tokens import Name
|
||||
|
||||
white_space_regex = re.compile('\\s+', re.MULTILINE)
|
||||
white_space_regex = re.compile(r'\\s+', re.MULTILINE)
|
||||
|
||||
|
||||
def _compile_regex(keyword):
|
||||
# Surround the keyword with word boundaries and replace interior whitespace
|
||||
# with whitespace wildcards
|
||||
pattern = '\\b' + re.sub(white_space_regex, '\\s+', keyword) + '\\b'
|
||||
pattern = r'\\b' + re.sub(white_space_regex, r'\\s+', keyword) + r'\\b'
|
||||
return re.compile(pattern, re.MULTILINE | re.IGNORECASE)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user