MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / get_sql_util_args

Function get_sql_util_args

web/pgadmin/tools/restore/__init__.py:377–405  ·  view source on GitHub ↗

return the args for the command :param data: Data. :param manager: Manager. :param server: Server. :param filepath: File. :return: args list.

(data, manager, server, filepath)

Source from the content-addressed store, hash-verified

375
376
377def get_sql_util_args(data, manager, server, filepath):
378 """
379 return the args for the command
380 :param data: Data.
381 :param manager: Manager.
382 :param server: Server.
383 :param filepath: File.
384 :return: args list.
385 """
386 restrict_key = secrets.token_hex(32)
387 host = manager.local_bind_host if manager.use_ssh_tunnel \
388 else server.host
389 port = manager.local_bind_port if manager.use_ssh_tunnel \
390 else server.port
391 args = [
392 '--dbname', data['database'],
393 '-c', f'\\restrict {restrict_key}',
394 '--file', fs_short_path(filepath)
395 ]
396 if host:
397 args.extend(['--host', host])
398
399 if port:
400 args.extend(['--port', str(port)])
401
402 if server.username:
403 args.extend(['--username', server.username])
404
405 return args
406
407
408def use_restore_utility(data, manager, server, driver, conn, filepath):

Callers 1

use_sql_utilityFunction · 0.85

Calls 2

fs_short_pathFunction · 0.90
extendMethod · 0.80

Tested by

no test coverage detected