A sample python package deployment utility for SQLShack Demo.
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 json | |
def greet(user): | |
print(f'Hello {user}') | |
def main(): | |
greet('Aveek') | |
if __name__ == '__main__': | |
main() |
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 json | |
def pos_arg(a,b,c): | |
print(f'The value of a is: {a}') | |
print(f'The value of b is: {b}') | |
print(f'The value of c is: {c}') | |
def main(): | |
pos_arg(10,20,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
import json | |
def greet(*users): | |
for user in users: | |
print(f'Welcome {user}') | |
def main(): | |
greet('Fred', 'Harry', 'Tom') | |
if __name__ == '__main__': |
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 json | |
def greet(**users): | |
for key,value in users.items(): | |
print(f'{key} => {value}.') | |
def main(): | |
greet(user='Tom', city='London', pet=['Dog', 'Cat', 'Fish']) | |
if __name__ == '__main__': |
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
def quicktext(): | |
print('Hello, welcome to QuickSample package.') |
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 setuptools | |
with open("README.md", "r") as fh: | |
long_description = fh.read() | |
setuptools.setup( | |
name="quicksample", # This is the name of the package | |
version="0.0.1", # The initial release version | |
author="Aveek Das", # Full name of the author | |
description="Quicksample Test Package for SQLShack Demo", |
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
ALTER TABLE mumbai_house_price_raw | |
ADD COLUMN house_price_category VARCHAR(20); | |
UPDATE mumbai_house_price_raw | |
SET house_price_category = CASE WHEN price < 20000 THEN 'Below 20K' | |
WHEN price >= 20000 AND price < 40000 THEN '20K - 40K' | |
WHEN price >= 40000 THEN 'Above 50K' | |
END; |
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
SELECT | |
house_price_category, | |
COUNT(1) number_houses | |
FROM mumbai_house_price_raw | |
GROUP BY house_price_category; |
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 OR REPLACE VIEW vw_mumbai_houses_airport_5km | |
AS | |
SELECT * | |
FROM mumbai_house_price_raw | |
WHERE 1=1 | |
AND ST_DISTANCE( | |
ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(72.874374 19.096713)',4326), 7755), | |
ST_TRANSFORM((geometry),7755) | |
) <= 5000; |