I try to understand The PostgresHook in Airflow. Here is the documentation:
.10.6/_api/airflow/hooks/postgres_hook/index.html
Now for example if I wanna understand the function
get_conn(self)
I know know what it does, but as a beginner in general, how can I understand how this function works, if there is literally no explanation in the documentation? There is only a link to the source code and that's it. So this means, to understand how the function works, I have to check the source code, right? This is a common way, how these documentations works?
I try to understand The PostgresHook in Airflow. Here is the documentation:
https://airflow.apache./docs/apache-airflow/1.10.6/_api/airflow/hooks/postgres_hook/index.html
Now for example if I wanna understand the function
get_conn(self)
I know know what it does, but as a beginner in general, how can I understand how this function works, if there is literally no explanation in the documentation? There is only a link to the source code and that's it. So this means, to understand how the function works, I have to check the source code, right? This is a common way, how these documentations works?
Share Improve this question asked Mar 21 at 2:08 Super_ProgrammerSuper_Programmer 32 bronze badges 4- Airflow is an open source project. You're welcome to contribute in many ways, including improving the documentation. See the Airflow Community pages for details. – Tangentially Perpendicular Commented Mar 21 at 3:27
- It's not much in the way of documentation (beyond the title of the method), but the base class has a very brief docstring attached: airflow.apache./docs/apache-airflow/1.10.6/_api/airflow/… – Blckknght Commented Mar 21 at 4:05
- What is a docstring exactly? The source code? – Super_Programmer Commented Mar 21 at 15:12
- Here's a idea: Google docstring – Belayer Commented Mar 21 at 17:43
1 Answer
Reset to default 0Be sure to look at the version and ensure that the version matches what you're running. You posted a link to version 1.10.6, which is about 4 years old. In Airflow 2, all the former "contrib" packages were moved into "provider" packages. If you are using a more recent version of Airflow, all the sql operators were abstracted to the commons.sql provider and you can find the code (including doc strings) in the python API page by clicking into the items.
To your question about get_conn
method in the postgres hook, here is a link to the code where you can see it take the information from your connection and use psycopg2 library to create a connection. This has been consistent across versions.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744375687a4571174.html
评论列表(0条)