0

I am using appache airflow for database connection .

I am using for the following code

>>> import json
>>> from airflow.models.connection import Connection

>>> c = Connection(
>>>     conn_id='some_conn',
>>>     conn_type='mysql',
>>>     description='connection description',
>>>     host='myhost.com',
>>>     login='myname',
>>>     password='mypassword',
>>>     extra=json.dumps(dict(this_param='some val', that_param='other val*')),
>>> )
>>> print(f"AIRFLOW_CONN_{c.conn_id.upper()}='{c.get_uri()}'")
AIRFLOW_CONN_SOME_CONN='mysql://myname:mypassword@myhost.com?this_param=some+val&that_param=other+val%2A'

Now the Data Establishment was done . But How do I get the tables associated with that perticulat DataBase

Anoop
  • 505
  • 8
  • 23

1 Answers1

0

You can get the tables in the database by using MySqlOperator with a query like this:

SELECT table_name FROM information_schema.tables
WHERE table_schema = 'your_database_name';

more on the query

SergiyKolesnikov
  • 7,369
  • 2
  • 26
  • 47