Open .sqlite files from terminal Mac - sqlite

I have to do a project with a SQL database. I am asked to use the following file:
https://github.com/jpwhite3/northwind-SQLite3/blob/master/Northwind_small.sqlite
But the file downloads as .sqlite and I can't open it from my terminal. It is part of the requirement to only open it from the terminal, I can't use SQLite studio or anything like that as I should be able to open it directly. When I try to open it I get the following error:
Error: near line 1: near "SQLite": syntax error
or got an empty database, but when I open it with SQLite studio, all the data is in the file.
This is a screenshot from my terminal:
Terminal
I need to download the data base and be able to manage it.

Related

Not automatically downloading dropbox files when opening data in R

I recently bought a new Macbook pro (M1) and am trying to run R codes.
I open and run a R script that I have been working, but data such as csv, excel files, and RData in the dropbox are not loaded. It works only after I manually download the files in Finder, otherwise files are not automatically downloaded when trying to load in R.
Here is an example of the code and the error message
setwd('/Users/xxx/Dropbox/Data')
load('dta.RData')
Error in load("dta.RData") :
empty (zero-byte) input file
If I manually download the "dta.Rata" in finder (using Make Available Offline) and run the same code it works well.
Any solution?
I found that this
https://help.dropbox.com/installs-integrations/desktop/macos-12-monterey-support
I guess we should wait until Dropbox find the solution.

How to fix Error in setwd("D:/") when opening R

I'm currently trying to Knit a file with RStudio and keep running into the below error:
Error in setwd("D:/") : cannot change working directory
Execution halted
However, when I check getwd() I get "/Users/my-name" as the working directory. I have also tried setwd("~/") and receive the same error in Markdown. Further, when I initially open RStudio I get
Error in setwd("D:/") : cannot change working directory
which suggests that there is an issue when I start R. Is there a way to get this error to stop from occurring when starting RStudio in the first place? I've tried deleting and redownloading RStudio but that doesn't seem to work. I'm currently using Mac OS Catalina.
Below is a screenshot of the error I receive when I open RStudio.
Thanks in advance.
I got similar issue with "setwd". When I did "save as" my existing code file from other folder to a new folder then I got an error: "cannot change working directory". When I did copy a code file from other folder and paste it into a new folder then I was able to run "setwd" and there was no error.

How to upload .r file into azure ml studio and run it?

I have a R file and I want to run the same in azureML studio.
After running the codes in Rstudio I zip the r file and import it into Azure studio's datasets.I pull the dataset and Execute R script module to the experiment and attach script bundle port to the zip file. It asks for a src path which I am not sure of. When I run, it says CONNECTION NOT FOUND.
What should be done to find the connection?
You can refer to the R script in the zip folder by referring to it through the Execute R Script module.
Use source("src/YourScriptName.r") for executing YourScriptName.r inside the zip file.

Cant start spark in terminal

I took the following steps to get spark up and running in rstudio
Downloaded it at: http://spark.apache.org/
Stored the file in the following dir: "C:\Users\Marc\Apache"
Now I have a bin file containing a sparkR file called: spark-1.6.1-bin-hadoop2.6. However when I open up my terminal, move to the right dir and try to run it using:
.bin\sparkR
I get the following error:
R is not recognized as an internal or external command ....
Any thoughts on what goes wrong here?
¿Do you have R installed and added to the PATH?
Also check R CMD on Windows 7 Error - "R" is not recognized as an internal or external command, it may help you.

Creating an sqlite database using command line shell in windows

I have my sqlite3.exe file in C:\ and i want to create an sqlite database in C:\db\sqlite.I have tried sqlite3 ex1 as suggested on the docs http://www.sqlite.org/sqlite.html but i get the error Error Near "sqlite3".
What is the correct way of creating a new database from the shell?.
Here is one way to use SQLite3 from the command prompt in Windows.
First you need to know the path to the folder where you installed the SQLite ODBC Driver. If you used the default settings this would be C:\Program Files\SQLite ODBC Driver on Windows XP
Go to Start -> Run -> type cmd -> click OK
This opens the command prompt.
In the Shell, type in the following command. You can use Alt + Space if you prefer to use cut and paste. Remember to modify the path for your setup if you installed SQLite in another folder.
cd C:\Program Files\SQLite ODBC Driver
This brings you to the SQLite install folder. Now you are ready to call SQLite. Type the following command at the SQLite prompt.
sqlite3
This opens the File menu where you can choose a database to connect to, or create a new database file.
Navigate to C:\db\sqlite and create myDatabase.db, and click Open to close the file menu.
Now you are ready to work on your new database, run your queries, e.g. create a table.
As new file is created in current directory, for creating file at different location you should follow this format:
eg. for storing file FILENAME.db at c:/users/xyz/abc
you should type
sqlite>.open c:/users/xyz/abc/FILENAME.db
and then press enter a new file will be created at the mentioned path.
and now when you will type .databases you will see your file listed in the list of databases.
You can use following command to create the sqlite database
.open databasename.db
or
.open c:/somefolder/databasename.db

Resources