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

Minimal necessary changes to run SQL query #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

solarchemist
Copy link

I have also proof-read the README and converted it to Markdown format for better legibility. Cheers! Details below.

library(DBI)
library(RSQLite)
sqlite_database_path <- "zotero.sqlite"
con <- dbConnect(SQLite(), dbname = sqlite_database_path)
zotero <- dbGetQuery(con,'
<SQL QUERY - (without the comment lines, and with single quotes escaped)>
')

I attempted to use the SQL query as-is but got errors related to the table creatorData which appears to have been renamed to creators by Zotero (just my guess). As none of the forks on Github contained newer code, I took it upon myself to attempt a fix.

My fix works for me, so I thought I could send you a PR in case you're still maintaing this code.

I also removed the lines referencing shortName, as I could not find (at a very quick glance) any such column in the available tables. The query now runs without errors as given above.

NB. I'm not at all comfortable with SQL syntax! So please double-check my code. Also, at least for me, the created R dataframe (see above) appears to have many duplicate rows (almost 4000 entries in Zotero but over 8000 rows returned by SQL query) and I have now idea why. Anyway, that's easy enough to work-around in R.

My environment:

  • OS Ubuntu 18.04
  • Zotero v5.0.89
  • R version 3.6.2
  • R packages: DBI v1.1.0, RSQLite v2.2.0

@RoyceKimmons
Copy link
Owner

Great work! I haven't touched this in years, so any updates are welcome.

@solarchemist
Copy link
Author

Glad to hear you approve of the PR! Looking forward to you merging it :-)

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 this pull request may close these issues.

2 participants