Skip to content

Commit

Permalink
Update singer_sdk/sinks/sql.py
Browse files Browse the repository at this point in the history
Co-authored-by: Aaron ("AJ") Steers <aj@meltano.com>
  • Loading branch information
Ken Payne and aaronsteers committed Oct 19, 2022
1 parent 5233657 commit e3e3a30
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions singer_sdk/sinks/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ def schema_name(self) -> Optional[str]:
The target schema name.
"""
parts = self.stream_name.split("-")
if len(parts) == 2:
return parts[0]
if len(parts) == 3:
return parts[1]
if len(parts) in {2, 3}:
# Stream name is a two-part or three-part identifier.
# Use the second-to-last part as the schema name.
return parts[-2]

# Schema name not detected.
return None

@property
Expand Down

0 comments on commit e3e3a30

Please sign in to comment.