cetingokhan commented on code in PR #61794:
URL: https://github.com/apache/airflow/pull/61794#discussion_r2812672009
##########
providers/postgres/src/airflow/providers/postgres/hooks/postgres.py:
##########
@@ -691,3 +691,11 @@ def insert_rows(
nb_rows += len(chunked_rows)
self.log.info("Loaded %s rows into %s so far", nb_rows,
table)
self.log.info("Done loading. Loaded a total of %s rows into %s",
nb_rows, table)
+
+ def get_schema(self, table_name: str):
+ from airflow.providers.common.sql.hooks.handlers import
fetch_all_handler
+
+ return self.run(
+ sql=f"""SELECT column_name, data_type FROM
information_schema.columns WHERE table_name = '{table_name}';""",
Review Comment:
inspector has get_columns method for the retrieve columns names with data
types;
I thnik we can use directly inspect propertry from the sql hooks?
Or we can call following in new get_schema method;
inspector.get_columns(table_name);
https://docs.sqlalchemy.org/en/14/core/reflection.html#sqlalchemy.engine.reflection.Inspector.get_columns
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]