Don't know how hard setting up a SQL database vs Mongo is really challenging; but I've honestly never had trouble installing postgres. Locally (OSX) I use http://postgresapp.com/ which works like a charm. Plus there's ActiveRecord since you mentioned using pg gems, and that basically makes your interaction with SQL to almost minimum.
I strongly recommend taking a look at Postgres.app, developed by Heroku. It's a 1-step installation (drag the application package into the /Applications directory), includes PostGIS and hstore extensions, comes with the usual command line utilities, etc. I've done a couple dozen Postgres installs on Mac OS and I've found this to be the most painless way to install, run, and manage PostgreSQL.
A working way is to get the Postgres.app and then install the gem with an argument for the path to pg_config (might be different for newer versions):
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
Postgres is pretty easy to setup these days if you use a mac checkout http://postgresapp.com/
Best to keep your prod and development the same will save you a lot of hassle in the future.
Also as a side note you can use Mysql with heroku you just have to add it as an add-on application.
How did you install Postgres?
If you used brew install postgresql
it should have put it in /usr/local/
If you installed Postgres.app it should have added itself to your PATH
variable.
The which
command only works for executables that are on your PATH
.
If you installed postgres and started it; you should know where the binaries were installed and you should have a bin/
directory that has all of the binary programs associated with this postgres cluster.
For instance on my mac:
ls /Applications/Postgres.app/Contents/MacOS/bin/ clusterdb gdal_contour gdallocationinfo invgeod pg_basebackup pg_standby psql createdb gdal_grid gdalmanage invproj pg_config pg_test_fsync raster2pgsql createlang gdal_rasterize gdalserver nad2bin pg_controldata pg_test_timing reindexdb createuser gdal_translate gdalsrsinfo nearblack pg_ctl pg_upgrade shp2pgsql cs2cs gdaladdo gdaltindex ogr2ogr pg_dump pgbench testepsg dropdb gdalbuildvrt gdaltransform ogrinfo pg_dumpall pgsql2shp vacuumdb droplang gdaldem gdalwarp ogrtindex pg_receivexlog postgres vacuumlo dropuser gdalenhance geod oid2name pg_resetxlog postmaster ecpg gdalinfo initdb pg_archivecleanup pg_restore proj
as you can see I have not just the postgres programs, but also a bunch associated with with PostGIS ( which uses the GDAL and OGR libraries ).
You'll need to add that directory to your PATH
.
You can do this from the command line by saying
export PATH=$PATH:/path/to/postgresql/binaries/
but really you should add it to your .profile
or .bash_profile
so that it will be set for all future sessions.
What do you mean by SQL exactly? Although there is a standard governing SQL language, in the real world every implementation varies a bit and hands on experience with a specific server is almost always worth more than an academic overview and a paper in your drawer.
It would help to narrow it down if you could specify a server/backend that you want/expect to deal with in the future. Popular ones include MS SQL, Oracle, MySQL and Postgres.
So.. I would recommend you to ask around what databases (servers) are used at your company and what an analyst will be expected to use. Also what tools/clients are preferred. What the common tasks and problems are what you might be facing.. etc.
If you ask for recommendations: my preferred db is Postgres. It's free, it's solid, widely used, well documented and there exists an excellent community. Also there are some awesome books out there.
Point your browser at http://postgresapp.com for an easy start on a Mac.
With the funding of Improved PostgreSQL support for Django, I'd say just go with Postgres. The array and hstore fields are a huge plus in Postgres. Full support for them in Django is coming. Hopefully v1.8. I've built a lot of Django projects, large and small with both MySQL/MariaDB and Postgres. I can't count how many times MySQL has puked during migrations and left me to clean up the mess. Also, if you're on a Mac, Postgres.app makes it dead simple to setup for development.
I do this all the time! Others have gone down mysql and MS SQL, I'll go down postgresql. First, it is fully supported on mac: Download for the full shebang, Interesting Download for an app based experience. Note that I have no direct experience with either package, and most of what I am going to say will relate more to the full install (all my implementations are direct linux distro packages). I do know that postgres works fantastically on macs. I have an old mac webserver running it, and OS X Server edition ships with postgres by default. Also, I believe Apple themselves have pushed some compatibility and performance changes.
So, SQL and SQL severs are not data analyst tools. They best at storing data, retrieving data and relating data. They are not good at consolidating information to a single number (outside of a few simple things like max/min). For that other tools like python are best.
So, what would SQL replace the best from excel? VLOOKUP and pivot tables. If that kind of stuff is what you do. Then SQL options could be exactly what you need.
If you do need "final numbers" then maybe you can add python into the mix. psycopg2 allows you to grab data from PostgreSQL very easily. With much more freedom than say, iterating over a CSV.
As to getting data in from CSV. Trivial
If you want to run a local copy on your mac, you can skip a good chunk of the setup steps by using the Postgres app: http://postgresapp.com/
You'll still need to do the database creation, but this should really drop the learning curve.
OSX: If you don't want one of the binary installers, don't want to use Homebrew, it won't get any easier than this: http://postgresapp.com/
Windows: EnterpriseDB has a binary installer: http://www.enterprisedb.com/products-services-training/pgdownload#windows
I don't see where MongoDB is any easier on any of the platforms mentioned above.
Are ORMs necessary then? Because in my tutorial I downloaded the Postgress App (http://postgresapp.com/) and connected to it using pg. Didn't use any ORM or anything.
I figured out how to create a the DATABASE_URL config var in heroku, but wasn't sure how to go from there. Do I need to create a username and password like I do if the database is local?
I'm not sure a home lab is necessary to run a database... postgres + postgis can be installed on virtually any system—it's not exactly a resource hog. On macOS I'd recommend Postgres.app and for windows, the installer's Stack Builder allows you to easily enable PostGIS.
Start here, try try psequel if you're not comfortable with the command line (psql) and you'll be up and running in no time. There are plenty of tutorials around, too.
If you're on Mac, there's Postgres.app. If you're on Linux, it's easy to install Postgres (sudo apt install postgresql postgresql-contrib
). So I just use Postgres in both development and production.
Are you trying to run postgres in development mode? Or are you having problems with running postgres on Heroku?
If in development, then the database: value should be the name of the development database, generally <app_name>_development
Did you install a postgres db locally? I use the postgres.app (http://postgresapp.com/) - very easy to install get get running. I use postico as the GUI if I need to examine the database.
My database.yml file looks like:
default: &default adapter: postgresql encoding: unicode # For details on connection pooling, see rails configuration guide # http://guides.rubyonrails.org/configuring.html#database-pooling pool: 5
development: <<: *default database: myapp_development
If you're having problems in production (heroku), do you actually have a postgres db addon installed?
heroku addons:add heroku-postgresql
As mentioned elsewhere, you don't have to run postgres locally - you can just sqlite in dev/test and just use pg for production.
Ah this is bcoz on os x the user posgres does not exist by default.
You need to add your db name, username and password in config.py before you run db.py migrate
if you are using http://postgresapp.com/ then "createuser postgres" from your terminal should do it else log into psql and run createuser postgres
Really the only thing Postgres.app gives in the GUI sense is a checkbox to allow you to tell it to boot at startup. Brew accomplishes the same thing by telling you to run some launchctl commands. Aside from that, and the ability to easily restart the DB by restarting the app, there is no GUI difference. Postgres.app opens the terminal and a command line psql prompt.
What it installs, however, is MUCH CLOSER to the actual Heroku install, AFAICT. I think you'd have to tinker for a while to get all the same things installed via command line (having done exactly that).
What's In The Box? Postgres.app contains a full-featured PostgreSQL installation in a single package:
PostgreSQL 9.4.4 PostGIS 2.1.7 Procedural languages: PL/pgSQL, PL/Perl, PL/Python, and PLV8 (Javascript) Popular extensions, including hstore and uuid-ossp, and more A number of command-line utilities for managing PostgreSQL and working with GIS data
Yeah, getting into the *nixy camp at all (Linux/OSX) is the important part.
OSX is polish on top of that. More developer mindshare, more people hacking on userland workflow improvements.
For example, I've been helping people set up Postgres on Windows and Ubuntu lately. I forgot how hellish it can be with its default authorization settings. And on Windows you have to install extensions by downloading .zip files and moving it into some directory like it's 2003 and you're cracking Paint Shop Pro.
Meanwhile on OSX, http://postgresapp.com/ takes care of everything.
Same with getting set up with Haskell. OSX has https://ghcformacosx.github.io/.
People like to focus on hardware and OS differences, but there's also a big difference in dev ecosystem.
If you're on OSX, http://postgresapp.com/ is the simplest way to run Postgres.
The first thing you generally need to do is give the app a connection string (URL) to your Postgres database so it can communicate with it.
Start off by creating a new database from your terminal:
createdb mydata
If that's successful, then your default local connection string will be this:
postgres://localhost:5432/mydata
Once you figure out how to feed that into your app (maybe a DATABASE_URL
variable?), try launching the app.
You didn't really provide much info.
It's a little Mac OS X status bar application that wraps the MongoDB binaries. The idea is to emulate the PostgreSQL experience provided by http://postgresapp.com/ but for the MongoDB camp.
Wasn't that clear from the README? Any specific suggestions to make the description clearer? Feedback is very much welcome.
If you're on a mac running 10.9 or above, you will probably need to additionally follow these instructions.
Basically add the following line to your .bash_profile:
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
I normally go with sqlite for the first week, only because I'm too lazy to setup the Postgres db. I only ever deploy to Postgres though.
If you're on OS X while developing, check this out http://postgresapp.com/, life saver.
It's the same as if it's installed any other way. Use PostgreSQL.app, it's the easiest way.
# settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '<db_name>', 'USER': '<your_username>', 'PASSWORD': '' } }
Make sure to install the psycopg2 package into your environment.