MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / reap_dbs

Function reap_dbs

lib/sqlalchemy/testing/provision.py:446–468  ·  view source on GitHub ↗
(idents_file)

Source from the content-addressed store, hash-verified

444
445
446def reap_dbs(idents_file):
447 log.info("Reaping databases...")
448
449 urls = collections.defaultdict(set)
450 idents = collections.defaultdict(set)
451 dialects = {}
452
453 with open(idents_file) as file_:
454 for line in file_:
455 line = line.strip()
456 db_name, db_url = line.split(" ")
457 url_obj = sa_url.make_url(db_url)
458 if db_name not in dialects:
459 dialects[db_name] = url_obj.get_dialect()
460 dialects[db_name].load_provisioning()
461 url_key = (url_obj.get_backend_name(), url_obj.host)
462 urls[url_key].add(db_url)
463 idents[url_key].add(db_name)
464
465 for url_key in urls:
466 url = list(urls[url_key])[0]
467 ident = idents[url_key]
468 run_reap_dbs(url, ident)
469
470
471@register.init

Callers

nothing calls this directly

Calls 7

openFunction · 0.85
run_reap_dbsFunction · 0.85
get_backend_nameMethod · 0.80
infoMethod · 0.45
get_dialectMethod · 0.45
load_provisioningMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected