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 psycopg2 | |
from psycopg2 import sql | |
def get_table_structure(db_name, user, password, host='localhost', port='5432'): | |
try: | |
# Connect to the PostgreSQL database | |
connection = psycopg2.connect( | |
dbname=db_name, | |
user=user, |
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
// if you have url pointing to a file and you want to download a file with a click, normally you can do <a href='url'>. | |
// But this doesn't work if serving domain and file url domain are not same. This is browser secuirty measure | |
//For those case, you can use the code below | |
function downloadFileFromURL(url, filename) { | |
$.ajax({ | |
type: "POST", | |
url: url, | |
data: params, | |
success: function(response, status, xhr) { |
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
... | |
# Slack error handling | |
from django.utils.log import DEFAULT_LOGGING | |
LOGGING = DEFAULT_LOGGING | |
LOGGING['handlers']['slack_admins'] = { | |
'level': 'ERROR', | |
'filters': ['require_debug_false'], # Remove this fileter (make empty array) to test on debug |