## ## ## This program is free software: you can redistribute it and/or modify ## ## it under the terms of the GNU General Public License as published by ## ## the Free Software Foundation, either version 3 of the License, or ## ## (at your option) any later version. ## ## ## ## This program is distributed in the hope that it will be useful, ## ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## ## GNU General Public License for more details. ## ## ## ## You should have received a copy of the GNU General Public License ## ## along with this program. If not, see <http://www.gnu.org/licenses/>. ## ## ## ########################################################################### from modules import utils if __name__ == "__main__": sources = [int(x) for x in utils.get_sources().keys()] dbconn = utils.get_dbconn() dbcurs = dbconn.cursor() tables = ["markers_counts", "markers", "markers_status", "updates"] for t in tables: dbcurs.execute("SELECT source_id FROM %s GROUP BY source_id;" % t) for res in dbcurs.fetchall(): if res[0] not in sources: print("DELETE FROM %s WHERE source_id = %d;" % (t, res[0]))
"tests/Analyser_Osmosis_Soundex-france_alsace-2014-06-17.xml.bz2" ) self.check_num_marker(50) def test_two_sources(self): self.check_num_marker(0) update( 1, "tests/Analyser_Osmosis_Soundex-france_alsace-2014-06-17.xml.bz2") self.check_num_marker(50) update( 2, "tests/Analyser_Osmosis_Broken_Highway_Level_Continuity-france_reunion-2014-06-11.xml.bz2" ) self.check_num_marker(50 + 99) ########################################################################### if __name__ == "__main__": sources = utils.get_sources() if len(sys.argv) == 1: for k in sorted([int(x) for x in sources.keys()]): source = sources[str(k)] print_source(source) elif sys.argv[1] == "--help": show(u"usage: update.py <source number> <url>") else: update(utils.get_sources()[sys.argv[1]], sys.argv[2])