- Read every row in the table
- No reading of index. Reading from indexes is also expensive.
This file contains hidden or 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
| #!/usr/bin/env python | |
| import os | |
| import argparse | |
| def convert_to_types(configs): | |
| config_list = list() | |
| for i, x in enumerate(configs): | |
| v = x.strip().split(' ') |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import sys | |
| from flake8.hooks import git_hook | |
| COMPLEXITY = 10 | |
| STRICT = False | |
| if __name__ == '__main__': | |
| sys.exit(git_hook(complexity=COMPLEXITY, strict=STRICT, ignore='E501')) | |
| # Alternatively |
This file contains hidden or 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 django.db import DEFAULT_DB_ALIAS | |
| queryset.query.get_compiler(DEFAULT_DB_ALIAS).as_sql() |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| from django import forms | |
| from crispy_forms.helper import FormHelper | |
| from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field | |
| from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions | |
| class MessageForm(forms.Form): | |
| text_input = forms.CharField() |
This file contains hidden or 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 foo (myid int, hdata hstore); | |
| INSERT INTO foo VALUES (10, '"name"=>"fred", "department"=>"IT"'); | |
| SELECT hdata->'name' FROM foo WHERE id = 10; | |
| SELECT hdata->'department' | |
| FROM foo |
This file contains hidden or 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
| # Copyright 2012 Erlware, LLC. All Rights Reserved. | |
| # | |
| # This file is provided to you under the Apache License, | |
| # Version 2.0 (the "License"); you may not use this file | |
| # except in compliance with the License. You may obtain | |
| # a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, |
This file contains hidden or 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
| -- An audit history is important on most tables. Provide an audit trigger that logs to | |
| -- a dedicated audit table for the major relations. | |
| -- | |
| -- This file should be generic and not depend on application roles or structures, | |
| -- as it's being listed here: | |
| -- | |
| -- https://wiki.postgresql.org/wiki/Audit_trigger_91plus | |
| -- | |
| -- This trigger was originally based on | |
| -- http://wiki.postgresql.org/wiki/Audit_trigger |
This file contains hidden or 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
| """ | |
| jQuery templates use constructs like: | |
| {{if condition}} print something{{/if}} | |
| This, of course, completely screws up Django templates, | |
| because Django thinks {{ and }} mean something. | |
| Wrap {% verbatim %} and {% endverbatim %} around those | |
| blocks of jQuery templates and this will try its best |