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 name, | |
type_desc, | |
create_date, | |
modify_date | |
FROM sys.objects |
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 c.name AS 'ColumnName', | |
t.name AS 'TableName' | |
FROM sys.columns c | |
JOIN sys.tables t | |
ON c.object_id = t.object_id | |
WHERE c.name LIKE '%sci_thin_credit_file_co_app%' | |
ORDER BY TableName,ColumnName |
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 * | |
FROM tempdb.sys.objects | |
ORDER BY create_date DESC |
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 Name | |
FROM sys.procedures | |
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%TableNameOrWhatever%' |
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 pandas as pd | |
import pandera as pa | |
from pandera import Check, Column, DataFrameSchema | |
schema = pa.DataFrameSchema( | |
columns={ | |
"int_column": Column(int), | |
"float_column": Column(float, Check.greater_than(0)), | |
"str_column": Column(str, Check.equal_to("a")), |
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
{{ config(store_failures = true) }} | |
-- Test | |
SELECT * | |
FROM <table> | |
WHERE <num_col> > 9 | |
UNION | |
SELECT * |
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 * from INFORMATION_SCHEMA.COLUMNS | |
where COLUMN_NAME like '%clientid%' | |
order by TABLE_NAME |
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 functools import partial, reduce | |
dfs = [df1, df2, df3] | |
merge = partial(pd.merge, on=['depth', 'profile'], how='outer') | |
reduce(merge, dfs) |
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
## Function | |
def get_first_non_null(dfrow, columns_to_search): | |
for c in columns_to_search: | |
if pd.notnull(dfrow[c]): | |
return dfrow[c] | |
return None | |
## Sample usage: | |
cols_to_search = ['a1', 'a2', 'a3'] | |
df['A'] = df.apply(lambda x: get_first_non_null(x, cols_to_search), axis=1) |
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
df.groupby(pd.Grouper(key='date', freq='M'))['col2'].sum() |
NewerOlder