Skip to content

gunderodd/cs50w-lecture-sql

 
 

Repository files navigation

CS50W lecture3: SQL

Source code and tips for examples from CS50W SQL lecture.

This repo is based on the source files that accompany lecture 3.

Changes

  1. A requirements.txt was added with libraries used in the lecture. An additional Postgres driver pg8000 is included.
  2. SQL connection logic modified to force SSL connection when pg8000 is detected in the URL
  3. SQL statements are combined in one file for convenience: _create_all_tables.sql

If you're having problems with psycopg2, you try out an alternative all-python library named pg8000. This repo includes pg8000 in the requirements.txt already.

Update your environment variable DATABASE_URL to use it by changing postgres to postgres+pg8000 at the start of the URL.

# old URL (sqlalchemy defaults to using psycopg2)
DATABASE_URL='postgres://xxxx:xxxxx@xxxxxx/xxxxxx'

# URL that uses pg8000
DATABASE_URL='postgres+pg8000://xxxx:xxxxx@xxxxxx/xxxxxx'

About

source code and tips for examples from CS50W SQL lecture

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 57.5%
  • HTML 41.6%
  • CSS 0.9%