Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving sqlite3.OperationalError when running res2sqlite.py #47

Closed
nhshetty-99 opened this issue Jul 6, 2020 · 9 comments · Fixed by #53
Closed

Receiving sqlite3.OperationalError when running res2sqlite.py #47

nhshetty-99 opened this issue Jul 6, 2020 · 9 comments · Fixed by #53
Assignees

Comments

@nhshetty-99
Copy link
Contributor

I am trying to parse a .res file for a project with the convert_arbin_to_sqlite() function in res2sqlite.py; however, I keep receiving an sqlite3.OperationalError.

This is the code snippet I am trying to run:
res.convert_arbin_to_sqlite(infilepath, outfilepath) # outfilepath is a .s3db file
connection = sqlite3.connect(outfilepath)
cursor = connection.execute('SELECT * FROM Global_Table')
data = cursor.fetchall()

However, after trying to run this, I keep receiving the following error message:
sqlite3.OperationalError: table Global_Table has no column named Log_Can_BMS_Data_Flag

I checked the res2sqlite.py source code, specifically the part where the Global_Table is created (starting from Line 37), and I notice that there are several columns, the first one being Log_Can_BMS_Data_Flag, which seem to be read in by my .res file but aren't present in the res2sqlite.py source code during the Global_Table creation process.

Has anyone received this kind of error before, and if so, can I please receive some assistance on it? Thanks!

@chatcannon
Copy link
Collaborator

My guess is that you have a newer version of the Arbin software which adds additional data columns to the .res file. It's been a long time since I had access to a battery cycler myself so I'm reliant on users to keep me updated with newer versions of the file format.

@chatcannon
Copy link
Collaborator

@nhshetty-99 Do you have a .res file that you are able to share with me so that I can add the necessary columns?

@nhshetty-99
Copy link
Contributor Author

Hi, Chris,

I do have an example of a .res file that I can provide you. I have attached a zip file of it to this post, and I used it to write in the new columns to two of the tables in my local copy of res2sqlite.py. The extra (column, type) pairs I needed to enter were:

  • Log_Can_BMS_Data_Flag, INTEGER
  • Software_Version, TEXT
  • Serial_Number, TEXT
  • Schedule_Version, TEXT
  • MASS, REAL
  • Specific_Capacity, REAL
  • Capacity, REAL

I added the above columns to the Global_Table table, in between the Log_Smart_Battery_Data_Flag and Item_ID columns.

I also had to include the following (column, type) pairs:

  • BATMAN_Status, INTEGER
  • DTM_PDM_Status, INTEGER

I added these ones to the Smart_Battery_Data_Table table, below the CycleCount columns and above the --Version 1.14 ends here... comment.

Please let me know if adding these columns to res2sqlite.py also lets you properly run my example .res file on your computer. Thanks!

res_zip.zip

@chatcannon
Copy link
Collaborator

@nhshetty-99 thanks for sending the file, and sorry for taking to long to get back to you on this.

The changes you suggested do indeed fix the problem of trying to put too much data into the existing tables and I have added a fix for that in https://github.com/chatcannon/galvani/tree/arbin-5-26

I will also look in more detail at the file you sent me to see if there are any additional tables that need to be imported.

@chatcannon
Copy link
Collaborator

@nhshetty-99 Would it be OK if I added the file you submitted to the (publicly available) test data for this project?

@chatcannon chatcannon self-assigned this Oct 17, 2020
@nhshetty-99
Copy link
Contributor Author

Hi, Chris,

Thank you so much for looking into this issue. I will check out the link you provided in your previous comment. There were also one or two more problems I was facing with the galvani module, so I will look into those a bit more and get back to you. As for the test file I provided you, I'll check with my research professor first and get back to you on that as well.

@nhshetty-99
Copy link
Contributor Author

Hi, Chris,

I talked to my research professor and coordinators, and they are okay with you using the example file I sent you for test data. I don't believe that file has any protected data, so it should be fine for usage. Additionally, my research coordinators were not able to get the uploaded version of galvani with all the recent merge requests when running pip install galvani in their virtual environments. We believe this is the case because the most recent release (0.1.0) for galvani was done back in June (I think). Is there a way we can use a forked version of this galvani module and use pip install on that? Will I need to submit my own releases in my forked in order for that to happen?

Thanks again for the help.

@chatcannon
Copy link
Collaborator

Since @bcolsen has not had time to review my changes in #53 I will merge it myself and make a new release to PyPI.

@chatcannon
Copy link
Collaborator

@nhshetty-99 FYI I just released version 0.2.0 which includes these changes and should now be available for download with pip.

https://github.com/echemdata/galvani/releases/tag/0.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants