Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def run(self):
- try:
- # Connect to an existing database
- self.conexao = psycopg2.connect(database=self.DATABASE_NAME, user=self.DATABASE_USERNAME, password=self.DATABASE_PASSWORD)
- # Because of the way sessions interact with notifications (see NOTIFY documentation), you should keep the connection in autocommit mode if you wish to receive or send notifications in a timely manner.
- self.conexao.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
- # Open a cursor to execute queries in the database
- # Fetch the results in an associative array
- self.cursor = self.conexao.cursor(cursor_factory=psycopg2.extras.DictCursor)
- except:
- self.logger.critical('Unable to connect to database and execute run')
- self.fetchUsers()
- self.checkRanking()
- self.pool.wait_completion()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement