This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE stream_user( | |
id SERIAL PRIMARY KEY NOT NULL | |
); | |
CREATE TABLE resource( | |
id SERIAL PRIMARY KEY NOT NULL, | |
condition_1 BOOLEAN, | |
condition_2 BOOLEAN, | |
condition_3 BOOLEAN, | |
condition_4 BOOLEAN, | |
condition_5 BOOLEAN, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import * | |
from sqlalchemy.orm import * | |
from sqlalchemy.ext.declarative import declarative_base | |
import sqlalchemy.exc | |
import pdb | |
from sqlalchemy.dialects import postgresql | |
INTERACTIVE = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- modified from http://stackoverflow.com/questions/6777456/get-the-list-all-index-names-its-column-names-and-its-table-name-of-a-postgresq | |
SELECT | |
idx.indrelid::regclass as indexed_tabled, | |
i.relname as index_name, | |
ARRAY( | |
SELECT pg_get_indexdef(idx.indexrelid, k + 1, true) | |
FROM generate_subscripts(idx.indkey, 1) as k | |
ORDER BY k | |
) as indkey_names | |
FROM pg_index as idx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlparse | |
from sqlalchemy.dialects import postgresql as dialect_postgresql | |
# ------------------------------------------------------------------------------ | |
def print_query(q): | |
"""prints a sqlalchemy query""" | |
print "-" * 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# | |
# Use this file to build your own SSCCE | |
# SSCCE = Short, Self Contained, Correct (Compatible) Example | |
# see http://sscce.org/ | |
# | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'0.1.0': {'pypi_file_md5': 'b74ed3d0d824ffaba34fc887784db4f3', | |
'pypi_file_url': 'https://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.1.0.tar.gz#md5=b74ed3d0d824ffaba34fc887784db4f3', | |
'pypi_url': 'https://pypi.python.org/pypi/SQLAlchemy/0.1.0', | |
'release_date': u'2006-02-14'}, | |
'0.1.1': {'pypi_file_md5': 'd88344c2a5628cc05d8d70ac5ddbe8ee', | |
'pypi_file_url': 'https://pypi.python.org/packages/2.4/S/SQLAlchemy/SQLAlchemy-0.1.1-py2.4.egg#md5=d88344c2a5628cc05d8d70ac5ddbe8ee', | |
'pypi_url': 'https://pypi.python.org/pypi/SQLAlchemy/0.1.1', | |
'release_date': u'2006-02-23'}, | |
'0.1.2': {'pypi_file_md5': '74862475a8366f74ccca6ca1ce9b0c99', | |
'pypi_file_url': 'https://pypi.python.org/packages/2.4/S/SQLAlchemy/SQLAlchemy-0.1.2-py2.4.egg#md5=74862475a8366f74ccca6ca1ce9b0c99', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wsgiref.simple_server import make_server | |
from pyramid.config import Configurator | |
from pyramid.response import Response | |
from pyramid.renderers import render_to_response, render | |
def json_bad(request): | |
return render_to_response('json', {'hello': 'world'}) | |
def json_good(request): | |
return render_to_response('json', {'hello': 'world'}, request=request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# | |
# Use this file to build your own SSCCE | |
# SSCCE = Short, Self Contained, Correct (Compatible) Example | |
# see http://sscce.org/ | |
# | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I've been getting A TON of spam hitting my inbox lately. 20+ messages a day. | |
sometimes more. Usually in the topics of : | |
- Medicare | |
- Rewards cards (amazon, home depot) | |
- Background Checks | |
- Lawsuits | |
- EZPass | |
- Sex offender notification | |
- Auto Warranty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyramid.view import view_config | |
def sample_callback(request): | |
pass | |
@view_config(route_name='home', renderer='templates/mytemplate.pt') | |
def my_view(request): | |
""" | |
1.6/master | |
BEFORE: request.finished_callbacks None |