officer_type_base2 = officer_types[1] elif index % 3 == 1: officer_type_base1 = officer_types[0] officer_type_base2 = officer_types[2] elif index % 3 == 2: officer_type_base1 = officer_types[1] officer_type_base2 = officer_types[2] offices_held1 = OfficesHeld( corp_party_id=index, officer_typ_cd=officer_type_base1, ) db.session.add(offices_held1) offices_held2 = OfficesHeld( corp_party_id=index, officer_typ_cd=officer_type_base2, ) db.session.add(offices_held2) index = index + 1 db.session.commit() if __name__ == '__main__': from search_api import create_app app = create_app('development') # pylint: disable=invalid-name with app.app_context(): reset() populate()
SQL = """ SELECT 1 FROM CORP_PARTY WHERE ROWNUM = 1 """ # SQL = """ # SELECT * # FROM all_indexes # WHERE table_name = 'ADDRESS'""" SQL = """ """ if __name__ == '__main__': app = create_app('benchmark') # pylint: disable=invalid-name with app.app_context(): for i in range(1): print('warmup') # t = time.time() # rs = benchmark_raw_sql(SQL) # _benchmark(t, rs) # print('cobrs') # t = time.time() # rs = benchmark_raw_sql(COBRS_SQL) # _benchmark(t, rs) t = time.time() rs = corp_party_addr_search()
def app_request(): """Return a session-wide application configured in TEST mode.""" _app = create_app('testing') return _app
# Copyright © 2020 Province of British Columbia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''Provides the WSGI entry point for running the application ''' from search_api import create_app # Openshift s2i expects a lower case name of application application = create_app() # pylint: disable=invalid-name if __name__ == "__main__": application.run()
def app(): """Create a Flask app context for the tests.""" _app = create_app('testing') return _app