-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
udpated sql for table comments #27
base: master
Are you sure you want to change the base?
Conversation
"\n", | ||
"\n", | ||
";\n", | ||
"--SQL Alchemy throws an error unless rows are returned. This works around the issue\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Yes, using pd.read_sql
is not really the right way to execute general SQL statements. The point of pd.read_sql
is to return a DataFrame object, so generally is used with select
SQL statements. To execute SQL in sqlalchemy
.
To execute SQL in sqlalchemy
you can use connection.execute
. See the docs for an example: http://docs.sqlalchemy.org/en/latest/core/connections.html.
In any case it's better that you added the comment stuff in the pipeline code. That way everything touching the database is in one place (and it's easy to recreate the state of the database at any point in time.
"source": [ | ||
"Get table comments. \n", | ||
"QUERY = \"\"\"\n", | ||
"COMMENT ON COLUMN data_ingest.sba__foia_504_1991_present.program IS 'Indicator of whether loan was approved under SBA''s 7(a) or 504 loan program'\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind removing these COMMENT ON
statements now that you added the code in pipeline_runner
?
Would you mind making Also do you mind adding the You'll likely just want to add it as another element in the list: https://github.com/sfbrigade/datasci-sba/blob/master/pipeline/pipeline_runner.py#L100 |
hmm might need to be careful with merge conflicts now that @zlatankr has renamed |
I still suck at git. Gotta git add before I git commit! This has additional comments for all SBA related tables and columns