-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change approach to emphasize sas_encoding.
- encoding argument may not be necessary if SAS is running UTF-8 and PostgreSQL is doing the same.
- Loading branch information
Showing
2 changed files
with
185 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "7acda8e4-ce19-4282-a579-6d90e5532ec5", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from wrds2pg import wrds_update, proc_contents, get_wrds_process" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "093ca05d-4340-4475-9da8-1f84f9e6bc4d", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Forcing update based on user request.\n", | ||
"Beginning file import at 2024-01-15 14:57:52 UTC.\n", | ||
"Importing data into risk.directors.\n", | ||
"Completed file import at 2024-01-15 14:58:07 UTC.\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"True" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"wrds_update(\"directors\", \"risk\",\n", | ||
" force=True,\n", | ||
" sas_encoding=\"wlatin1\",\n", | ||
" col_types={'annrev': 'float8',\n", | ||
" 'year_term_ends': 'float8',\n", | ||
" 'voting': 'float8',\n", | ||
" 'votecref':'float8',\n", | ||
" 'outside_public_boards': 'text'})" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "a64a74fc-d004-4437-9520-568abc76beb0", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Forcing update based on user request.\n", | ||
"Beginning file import at 2024-01-15 14:59:05 UTC.\n", | ||
"Importing data into tfn.idfhist.\n", | ||
"Completed file import at 2024-01-15 15:01:25 UTC.\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"wrds_update(\"idfhist\", \"tfn\", \n", | ||
" force=True, \n", | ||
" sas_encoding=\"wlatin1\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "be3ee283-a53c-4c2e-a756-a0781fe0d22a", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"tfn.table1_test already up to date.\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"wrds_update(\"table1\", \"tfn\",\n", | ||
" alt_table_name=\"table1_test\",\n", | ||
" sas_encoding=\"wlatin1\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"id": "45c3c121-74ee-4947-8275-fb581178860b", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Forcing update based on user request.\n", | ||
"Beginning file import at 2024-01-15 15:36:10 UTC.\n", | ||
"Importing data into tfn.table2.\n", | ||
"Completed file import at 2024-01-15 15:45:04 UTC.\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"updated = wrds_update(\"table2\", \"tfn\", sas_encoding=\"wlatin1\", force=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "de475208-f64b-440a-b1a6-8d969f0e8327", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.7" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
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