| # Copyright 2016 Google Inc. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| def create_database(inpath, outpath): |
| with sqlite3.connect(outpath) as conn: |
| c.execute('''CREATE TABLE IF NOT EXISTS gradients ( |
| c.execute("DELETE FROM gradients"); |
| with open(inpath, "r") as results: |
| for line in [line.strip() for line in results]: |
| gradients.append(line.split()); |
| "INSERT INTO gradients VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", |
| if __name__ == "__main__": |
| parser = argparse.ArgumentParser( |
| description = "Transform Lua script output to a SQL DB"); |
| parser.add_argument("inpath", help="Path to Lua script output file"); |
| parser.add_argument("outpath", help="Path to SQL DB"); |
| args = parser.parse_args(); |
| create_database(args.inpath, args.outpath); |