uranusjr opened a new pull request, #35598:
URL: https://github.com/apache/airflow/pull/35598
Small thing I’ve been cooking…
This is heavily inspired by the Object Store. Internally it just calls to
hooks, but allows you to do
```python
from airflow.providers.common.sql.db import Database
db = Database(conn_id="my-db-conn")
hook = db.create_hook(...) # Additional flags to hook.
db = Database.default(protocol="sqlite3") # Use default conn defined by the
provider.
with db.connect(...) as conn: # Shorthand for
db.create_hook(...).get_conn() with management.
conn.execute("SELECT 1")
```
Definition is currently provided for SQLite. More will be added once the
interface is figured out.
----
One thought on this to @bolkedebruin: Does the Object Store intend to cover
non-file sources in the future? If it does, that should take precedence over
this. But if not, I feel we should rename it to something less generic, maybe
IO Store or File Store instead, since SQL databases are also a kind of object
storage (for a certain definition of objects) but don’t fit into the current
Object Store design.
--
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]