eyeonus / Trade-Dangerous

Mozilla Public License 2.0
96 stars 31 forks source link

SQL error on first re-import of `eddblink` #180

Open ultimatespirit opened 3 weeks ago

ultimatespirit commented 3 weeks ago

I think this may end up being a consistency issue from my still using the same database from a month or so ago so some interim updates messed it up. However, every time I run the eddblink import the first execution will fail with the following error. The only time it hasn't done that was when I updated again within 24 hours or so.

$ ./trade.py import -P eddblink
NOTE: Checking for update to 'System.csv'.
NOTE: Downloading file 'System.csv'.
NOTE: Requesting https://elite.tromador.com/files/System.csv
NOTE: Downloaded   2.3MB of gziped data   3.5MB/s
NOTE: Checking for update to 'Station.csv'.
NOTE: Downloading file 'Station.csv'.
NOTE: Requesting https://elite.tromador.com/files/Station.csv
NOTE: Downloaded  28.9MB of gziped data  14.3MB/s
NOTE: Checking for update to 'Item.csv'.
NOTE: Downloading file 'Item.csv'.
NOTE: Requesting https://elite.tromador.com/files/Item.csv
NOTE: Downloaded  19.1KB of gziped data   4.5MB/s
NOTE: Checking for update to 'Category.csv'.
NOTE: Downloading file 'Category.csv'.
NOTE: Requesting https://elite.tromador.com/files/Category.csv
NOTE: Downloaded 250.0B  of gziped data  78.1KB/s
NOTE: Rebuilding cache file: this may take a few moments.
Traceback (most recent call last):
  File ".../Trade-Dangerous/./trade.py", line 44, in <module>
    cli.main(sys.argv)
  File ".../Trade-Dangerous/tradedangerous/cli.py", line 66, in main
    trade(argv)
  File ".../Trade-Dangerous/tradedangerous/cli.py", line 121, in trade
    results = cmdenv.run(tdb)
              ^^^^^^^^^^^^^^^
  File ".../Trade-Dangerous/tradedangerous/commands/commandenv.py", line 84, in run
    return self._cmd.run(results, self, tdb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../Trade-Dangerous/tradedangerous/commands/import_cmd.py", line 124, in run
    if not plugin.run():
           ^^^^^^^^^^^^
  File ".../Trade-Dangerous/tradedangerous/plugins/eddblink_plug.py", line 469, in run
    self.tdb.reloadCache()
  File ".../Trade-Dangerous/tradedangerous/tradedb.py", line 700, in reloadCache
    cache.buildCache(self, self.tdenv)
  File ".../Trade-Dangerous/tradedangerous/cache.py", line 1015, in buildCache
    processPricesFile(tdenv, tempDB, pricesPath)
  File ".../Trade-Dangerous/tradedangerous/cache.py", line 656, in processPricesFile
    stations, items, zeros, newItems, updtItems, ignItems, numSys = processPrices(
                                                                    ^^^^^^^^^^^^^^
  File ".../Trade-Dangerous/tradedangerous/cache.py", line 611, in processPrices
    changeStation(matches)
  File ".../Trade-Dangerous/tradedangerous/cache.py", line 471, in changeStation
    inscur.execute("""
sqlite3.IntegrityError: NOT NULL constraint failed: Station.station_id

The second execution will skip that step I'm guessing and work fine, at least insofar as not hitting this integrity error.

eyeonus commented 3 weeks ago

I don't know what is causing your problem. Please run with -wwwvvv and post the output of a run with the problem occurring to a gist.

Until this is fixed, you can use -O clean as a work around.

nepomuk16321 commented 3 weeks ago

Wasn't that the problem with the moving fleet carriers? The second run always worked for me. I have just updated to 11.5.0. Everything is ok, runs perfectly.