@@ -1823,7 +1823,7 @@ def to_pandas(cur):
1823
1823
1824
1824
color_term = True
1825
1825
1826
- class connect2 (easy_or ):
1826
+ class connect (easy_or ):
1827
1827
def __init__ (self , section = '' , quiet = False ):
1828
1828
self .quiet = quiet
1829
1829
conf = config_mod .get_config (config_file )
@@ -1873,61 +1873,6 @@ def describe_table(self, tablename):
1873
1873
self .do_describe_table (tablename ,False )
1874
1874
1875
1875
1876
- class connect ():
1877
- def __init__ (self , section = '' , quiet = False ):
1878
- self .quiet = quiet
1879
- conf = config_mod .get_config (config_file )
1880
- self .conf = conf
1881
- pd .set_option ('display.max_rows' , conf .getint ('display' , 'max_rows' ))
1882
- pd .set_option ('display.width' , conf .getint ('display' , 'width' ))
1883
- pd .set_option ('display.max_columns' , conf .getint ('display' , 'max_columns' ))
1884
- if section == '' :
1885
- db = conf .get ('easyaccess' , 'database' )
1886
- else :
1887
- db = section
1888
- self .prefetch = conf .getint ('easyaccess' , 'prefetch' )
1889
- self .dbname = db
1890
- # connect to db
1891
- desconf = config_mod .get_desconfig (desfile , self .dbname )
1892
- self .desconf = desconf
1893
- self .user = desconf .get ('db-' + self .dbname , 'user' )
1894
- self .dbhost = desconf .get ('db-' + self .dbname , 'server' )
1895
- self .port = desconf .get ('db-' + self .dbname , 'port' )
1896
- self .password = desconf .get ('db-' + self .dbname , 'passwd' )
1897
- kwargs = {'host' : self .dbhost , 'port' : self .port , 'service_name' : self .dbname }
1898
- dsn = cx_Oracle .makedsn (** kwargs )
1899
- if not quiet : print 'Connecting to DB ** %s ** ...' % self .dbname
1900
- connected = False
1901
- for tries in range (3 ):
1902
- try :
1903
- self .Connection = cx_Oracle .connect (self .user , self .password , dsn = dsn )
1904
- connected = True
1905
- break
1906
- except Exception as e :
1907
- lasterr = str (e ).strip ()
1908
- print "Error when trying to connect to database: %s" % lasterr
1909
- print "\n Retrying...\n "
1910
- time .sleep (8 )
1911
- if not connected :
1912
- print '\n ** Could not successfully connect to DB. Try again later. Aborting. ** \n '
1913
- os ._exit (0 )
1914
-
1915
- def ping (self ):
1916
- try :
1917
- self .Connection .ping ()
1918
- if not self .quiet : print 'Still connected to DB'
1919
- except :
1920
- if not self .quiet : print 'Connection with DB lost'
1921
-
1922
- def cursor (self ):
1923
- cursor = self .Connection .cursor ()
1924
- cursor .arraysize = self .prefetch
1925
- return cursor
1926
-
1927
- def close (self ):
1928
- self .Connection .close ()
1929
-
1930
-
1931
1876
# #################################################
1932
1877
1933
1878
class MyParser (argparse .ArgumentParser ):
0 commit comments