MCPcopy Index your code
hub / github.com/catherinedevlin/ipython-sql / __init__

Method __init__

src/sql/connection.py:10–22  ·  view source on GitHub ↗
(self, connect_str=None)

Source from the content-addressed store, hash-verified

8 return "Format: (postgresql|mysql)://username:password@hostname/dbname, or one of %s" \
9 % str(cls.connections.keys())
10 def __init__(self, connect_str=None):
11 try:
12 engine = sqlalchemy.create_engine(connect_str)
13 except: # TODO: bare except; but what's an ArgumentError?
14 print(self.tell_format())
15 raise
16 self.dialect = engine.url.get_dialect()
17 self.metadata = sqlalchemy.MetaData(bind=engine)
18 self.name = self.assign_name(engine)
19 self.session = engine.connect()
20 self.connections[self.name] = self
21 self.connections[str(self.metadata.bind.url)] = self
22 Connection.current = self
23 @classmethod
24 def get(cls, descriptor):
25 if isinstance(descriptor, Connection):

Callers

nothing calls this directly

Calls 2

tell_formatMethod · 0.95
assign_nameMethod · 0.95

Tested by

no test coverage detected