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
select t.table_schema, t.table_name, | |
'TRUNCATE public.' || t.table_name || ' CASCADE;', 'insert into public.' | |
|| t.table_name || '(' || string_agg(c.column_name, ',') || ') select ' || string_agg(c.column_name, ',') || ' from ' | |
|| 'main.' || substring(t.table_name from 6) || ';' | |
from information_schema.columns c | |
join information_schema.tables t on t.table_name = c.table_name and t.table_schema = 'public' | |
where t.table_schema in ('public') and t.table_type = 'BASE TABLE' | |
GROUP BY t.table_schema, t.table_name; |
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
def bubble_sort(a_list): | |
"""Realizes a bubble sort algorithm. | |
Time complexity: O(n^2) | |
""" | |
for one_pass in range(len(a_list)-1): | |
for i in range(len(a_list)-1): | |
if a_list[i] > a_list[i+1]: | |
a_list[i], a_list[i+1] = a_list[i+1], a_list[i] | |
return a_list |
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
""" | |
class_property.py | |
================= | |
Shows how to use python's built-in class 'property' for implementation of | |
encapsulation by pythonic way. | |
Use 'python3 -i class_property' for testing Man class interfaces. | |
Instance of this class will be already initialized as 'man' variable. |
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
""" | |
base_werkzeug_app.py | |
==================== | |
Example of a simple app written using werkzeug library. | |
""" | |
import json | |
import psycopg2 | |
from werkzeug.exceptions import HTTPException |
NewerOlder