def test_app_inclusion_list_excluded(self):
     # Inclusion list "wins"
     schema._get_includes = lambda: ('explorer_', )
     schema._get_excludes = lambda: ('explorer_', )
     res = schema.schema_info(get_connection())
     tables = [x[0] for x in res]
     self.assertIn('explorer_query', tables)
 def test_app_inclusion_list_excluded(self):
     # Inclusion list "wins"
     schema._get_includes = lambda: ('explorer_',)
     schema._get_excludes = lambda: ('explorer_',)
     res = schema.schema_info(get_connection())
     tables = [x[0] for x in res]
     self.assertIn('explorer_query', tables)
 def test_app_inclusion_list(self, ):
     schema._get_includes = lambda: ('auth_', )
     schema._get_excludes = lambda: []
     res = schema.schema_info(get_connection())
     tables = [x[0] for x in res]
     self.assertNotIn('explorer_query', tables)
     self.assertIn('auth_user', tables)
 def test_app_inclusion_list(self, ):
     schema._get_includes = lambda: ('auth_',)
     schema._get_excludes = lambda: []
     res = schema.schema_info(get_connection())
     tables = [x[0] for x in res]
     self.assertNotIn('explorer_query', tables)
     self.assertIn('auth_user', tables)
Example #5
0
 def _get_numerics(self):
     conn = get_connection()
     if hasattr(conn.Database, "NUMBER"):
         return [ix for ix, c in enumerate(self._description) if hasattr(c, 'type_code') and c.type_code in conn.Database.NUMBER.values]
     elif self.data:
         d = self.data[0]
         return [ix for ix, _ in enumerate(self._description) if not isinstance(d[ix], six.string_types) and six.text_type(d[ix]).isnumeric()]
     return []
 def _get_numerics(self):
     conn = get_connection()
     if hasattr(conn.Database, "NUMBER"):
         return [ix for ix, c in enumerate(self._description) if hasattr(c, 'type_code') and c.type_code in conn.Database.NUMBER.values]
     elif self.data:
         d = self.data[0]
         return [ix for ix, _ in enumerate(self._description) if not isinstance(d[ix], six.string_types) and six.text_type(d[ix]).isnumeric()]
     return []
Example #7
0
    def execute_query(self):
        conn = get_connection()
        cursor = conn.cursor()
        start_time = time()

        try:
            cursor.execute(self.sql)
        except DatabaseError as e:
            cursor.close()
            raise e

        return cursor, ((time() - start_time) * 1000)
    def execute_query(self):
        conn = get_connection()
        cursor = conn.cursor()
        start_time = time()

        try:
            cursor.execute(self.sql)
        except DatabaseError as e:
            cursor.close()
            raise e

        return cursor, ((time() - start_time) * 1000)
 def test_table_exclusion_list(self):
     schema._get_includes = lambda: None
     schema._get_excludes = lambda: ('explorer_', )
     res = schema.schema_info(get_connection())
     tables = [x[0] for x in res]
     self.assertNotIn('explorer_query', tables)
 def test_schema_info_returns_valid_data(self):
     schema._get_includes = lambda: None
     schema._get_excludes = lambda: []
     res = schema.schema_info(get_connection())
     tables = [x[0] for x in res]
     self.assertIn('explorer_query', tables)
Example #11
0
 def get(self, request, *args, **kwargs):
     return render_to_response('explorer/schema.html',
                               {'schema': schema_info(get_connection())})
Example #12
0
File: views.py Project: grouwner/sc
 def get(self, request, *args, **kwargs):
     return render_to_response('explorer/schema.html',
                               {'schema': schema_info(get_connection())})
 def test_table_exclusion_list(self):
     schema._get_includes = lambda: None
     schema._get_excludes = lambda: ('explorer_',)
     res = schema.schema_info(get_connection())
     tables = [x[0] for x in res]
     self.assertNotIn('explorer_query', tables)
 def test_schema_info_returns_valid_data(self):
     schema._get_includes = lambda: None
     schema._get_excludes = lambda: []
     res = schema.schema_info(get_connection())
     tables = [x[0] for x in res]
     self.assertIn('explorer_query', tables)