Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit bc634d1

Browse files
authored
Rename test files based on source code for Merge (#401)
Some minor fixups in tests: - `tests/sql/operators/test_agnostic_merge.py` -> `tests/sql/operators/test_merge.py` - Tests in `test_sqlite_append.py` should already be covered by `test_append.py` - `drop_table_postgres` was unused - `astro.sqlite_utils` -> `astro.utils.sqlite_utils` - This function is temporary here until we refactor append and merge but in the meantime it was weird to have a file at top level
1 parent 7c4f91d commit bc634d1

File tree

6 files changed

+2
-272
lines changed

6 files changed

+2
-272
lines changed

src/astro/utils/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from sqlalchemy.engine import Engine, ResultProxy
77

88
from astro.constants import CONN_TYPE_TO_DATABASE, Database
9-
from astro.sqlite_utils import create_sqlalchemy_engine_with_sqlite
109
from astro.utils.dependencies import BigQueryHook, PostgresHook, SnowflakeHook
10+
from astro.utils.sqlite_utils import create_sqlalchemy_engine_with_sqlite
1111

1212

1313
def create_database_from_conn_id(conn_id: str) -> Database:
File renamed without changes.

tests/sql/operators/test_sqlite_append.py

Lines changed: 0 additions & 258 deletions
This file was deleted.

tests/sql/operators/utils.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,6 @@ def drop_table_snowflake(
8585
snowflake_conn.close()
8686

8787

88-
def drop_table_postgres(
89-
table_name: str, conn_id: str = "postgres_conn", schema: str = "postgres"
90-
):
91-
hook = PostgresHook(postgres_conn_id=conn_id, schema=schema)
92-
postgres_conn = hook.get_conn()
93-
cursor = postgres_conn.cursor()
94-
cursor.execute(f"DROP TABLE IF EXISTS {table_name} CASCADE;")
95-
postgres_conn.commit()
96-
cursor.close()
97-
postgres_conn.close()
98-
99-
10088
def run_dag(dag):
10189
dag.clear(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE, dag_run_state=State.NONE)
10290

tests/utils/test_database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
from sqlalchemy.engine.base import Engine
88

99
from astro.constants import Database
10-
from astro.sqlite_utils import create_sqlalchemy_engine_with_sqlite
1110
from astro.utils.database import (
1211
create_database_from_conn_id,
1312
get_database_name,
1413
get_sqlalchemy_engine,
1514
run_sql,
1615
)
1716
from astro.utils.dependencies import BigQueryHook, PostgresHook, SnowflakeHook
17+
from astro.utils.sqlite_utils import create_sqlalchemy_engine_with_sqlite
1818

1919

2020
def describe_create_database():

0 commit comments

Comments
 (0)