bigquery_validator/bigquery_validator.py
def auto_validate_query_from_file(self, file_path):
        """Continuously monitor a sql file and automatically validate the sql on every saved change to the file.
        Any Jinja templated params will be automatically parsed on update.

        Parameters:
        file_path (str): Path to the sql file on the file system
       """
        try:
            _cached_stamp = 0
            while True:
                # TODO monitor query validator config for changes too
                stamp = os.stat(file_path).st_mtime
                if stamp != _cached_stamp:
                    print(f'Loading...{RESET_SEQ}', end='                                                          \r')
                    _cached_stamp = stamp
                    templated_query = read_sql_file(file_path)
                    formatted_query = self.render_templated_query(templated_query)
                    querv_is_valid, message = self.dry_run_query(formatted_query)

                    logging.info(f'Query is {"valid" if querv_is_valid else "invalid"}')

                    if querv_is_valid:
                        # Extra white space here is quick workaround to remove all text from last message
                        # when the previous message length exceeds the new message length
                        print_success(f'Valid query. {message}{RESET_SEQ}',
                                      end='                                                                         \r')
                    else:
                        print_failure(f'Invalid query. {message}{RESET_SEQ}',
                                      end='                                                                         \r')
        except Exception as e:
            logging.error(e)
            return False
Continuously monitor a sql file and automatically validate the sql on every saved change to the file.
        Any Jinja templated params will be automatically parsed on update.

        Parameters:
        file_path (str): Path to the sql file on the file system
       
Continuously monitor a sql file and automatically validate the sql on every saved change to the file.
Any Jinja templated params will be automatically parsed on update.

file_path (str): Path to the sql file on the file system
Continuously monitor a sql file and automatically validate the sql on every saved change to the file . Any Jinja templated params will be automatically parsed on update . file_path ( str ) : Path to the sql file on the file system
def auto_validate_query_from_file(self, file_path):
        try:
            _cached_stamp = 0
            while True:
                stamp = os.stat(file_path).st_mtime
                if stamp != _cached_stamp:
                    print(f'Loading...{RESET_SEQ}', end='                                                          \r')
                    _cached_stamp = stamp
                    templated_query = read_sql_file(file_path)
                    formatted_query = self.render_templated_query(templated_query)
                    querv_is_valid, message = self.dry_run_query(formatted_query)
                    logging.info(f'Query is {"valid" if querv_is_valid else "invalid"}')
                    if querv_is_valid:
                        print_success(f'Valid query. {message}{RESET_SEQ}',
                                      end='                                                                         \r')
                    else:
                        print_failure(f'Invalid query. {message}{RESET_SEQ}',
                                      end='                                                                         \r')
        except Exception as e:
            logging.error(e)
            return False
def auto_validate_query_from_file ( self , file_path ) : try : _cached_stamp = 0 while True : stamp = os . stat ( file_path ) . st_mtime if stamp != _cached_stamp : print ( f'Loading...{RESET_SEQ}' , end = '                                                          \r' ) _cached_stamp = stamp templated_query = read_sql_file ( file_path ) formatted_query = self . render_templated_query ( templated_query ) querv_is_valid , message = self . dry_run_query ( formatted_query ) logging . info ( f'Query is {"valid" if querv_is_valid else "invalid"}' ) if querv_is_valid : print_success ( f'Valid query. {message}{RESET_SEQ}' , end = '                                                                         \r' ) else : print_failure ( f'Invalid query. {message}{RESET_SEQ}' , end = '                                                                         \r' ) except Exception as e : logging . error ( e ) return False
Continuously monitor a sql file and automatically validate the sql on every saved change to the file.
Continuously monitor a sql file and automatically validate the sql on every saved change to the file .
"""Continuously monitor a sql file and automatically validate the sql on every saved change to the file.
        Any Jinja templated params will be automatically parsed on update.

        Parameters:
        file_path (str): Path to the sql file on the file system
       """ # TODO monitor query validator config for changes too # Extra white space here is quick workaround to remove all text from last message # when the previous message length exceeds the new message length
self
file_path