How to use _custom_select_query method in autotest

Best Python code snippet using autotest_python

models.py

Source:models.py Github

copy

Full Screen

...304 return [item['test_idx'] for item in dicts]305 def query_test_label_ids(self, filter_data):306 query_set = self.model.query_objects(filter_data)307 query_set = self._add_label_joins(query_set, suffix='_list')308 rows = self._custom_select_query(query_set, ['test_labels_list.id'])309 return [row[0] for row in rows if row[0] is not None]310 def escape_user_sql(self, sql):311 sql = super(TestViewManager, self).escape_user_sql(sql)312 return sql.replace('test_idx', self.get_key_on_this_table('test_idx'))313class TestView(dbmodels.Model, model_logic.ModelExtensions):314 extra_fields = {315 'DATE(job_queued_time)': 'job queued day',316 'DATE(test_finished_time)': 'test finished day',317 }318 group_fields = [319 'test_name',320 'status',321 'kernel',322 'hostname',...

Full Screen

Full Screen

query_manager.py

Source:query_manager.py Github

copy

Full Screen

...48 """49 delete_table_wrapper = self._decorator(self._committable_pattern)50 delete_table_wrapper(self.DELETE_TABLE.format(table_name))51 self.logger.warning(f"Table {table_name} is deleted")52 def _custom_select_query(self, query: str) -> tuple:53 selection_wrapper = self._decorator(self._fetch_data_pattern)54 data = selection_wrapper(query)55 return data56 def select_all(self, table_name: str) -> tuple:57 """58 choose all columns from table and receive all rows.59 :parameter table_name: name of table from that you want to receive a data60 :return: tuple of tuples61 """62 if not QueryUtils.check_table_name(table_name):63 raise IOError("Not allowed name for table", table_name)64 data = self._custom_select_query(self.SELECT_ALL.format(table_name))65 self.logger.info(f"data from {table_name} is received")66 return data67 def select_all_where(self, table_name: str, condition: str) -> tuple:68 """69 select all columns with conditions WHERE.70 :param table_name: name of table from where you receive data71 :param condition: conditions after WHERE, do not use other key words!,72 all operators should be separated by space.73 """74 # if QueryUtils.check_functional_words(condition):75 # raise IOError("Unavailable input by using prohibited key words", condition)76 if not QueryUtils.check_table_name(table_name):77 raise IOError("Not allowed name for table", table_name)78 data = self._custom_select_query(self.SELECT_ALL_WHERE.format(table_name, condition))79 self.logger.info(f"data from {table_name} where {condition} is received")80 return data81 def insert_data(self, table_name: str, columns: str, values: str):82 """83 send a custom insertion query to database.84 :param table_name: name of table you want to insert new data85 :param columns: names of columns in the table in form of (col1, col2, ...)86 :param values: the data in form of (val11, val12, ... ), (val22, val22, ...)87 """88 if not QueryUtils.check_table_name(table_name):89 raise IOError("Not allowed name for table", table_name)90 insert_data_wrapper = self._decorator(self._committable_pattern)91 insert_data_wrapper(self.INSERT_DATA.format(table_name, columns, values))92 self.logger.info("data is inserted")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful