skytracker.storage.tables.aircraft.AircraftTableManager#

class skytracker.storage.tables.aircraft.AircraftTableManager(database: DatabaseManager)#

Bases: TableManager[Aircraft]

Async aircraft table manager

Properties

TABLE_FIELDS

column_name - column_type pairs

TABLE_KEYS

keys used in database table

TABLE_NAME

name of aircraft table

Methods

__init__

Initialize table manager by storing database manager

ensure_exists

Ensure aircraft table exists

get_aircraft

Get an aircraft by registration

search_aircraft

Search for aircraft matching specific information

__init__(database: DatabaseManager) None#

Initialize table manager by storing database manager

Parameters:

database (DatabaseManager) – ClickHouse database manager

async ensure_exists() None#

Ensure aircraft table exists

async get_aircraft(registration: str) Aircraft#

Get an aircraft by registration

Parameters:

registration (str) – aircraft registration (tail number)

Returns:

aircraft with specified registration

Return type:

Aircraft

async search_aircraft(fields: dict[str, Any], limit: int = 0) list[Aircraft]#

Search for aircraft matching specific information

Parameters:
  • fields (dict[str, Any]) – field-value pairs to search for

  • limit (int, optional) – maximum number of aircraft to retrieve (0=all). Defaults to 0.

Returns:

list of aircraft matching fields

Return type:

list[Aircraft]

TABLE_FIELDS: dict[str, str] = {'identity__airline_iata': 'Nullable(FixedString(2))', 'identity__airline_icao': 'Nullable(FixedString(3))', 'identity__icao24': 'FixedString(6)', 'identity__owner': 'Nullable(String)', 'identity__registration': 'FixedString(10)', 'identity__test_registration': 'Nullable(FixedString(10))', 'lifecycle__age': 'Nullable(Int16)', 'lifecycle__date_delivery': 'FixedString(20)', 'lifecycle__date_first_flight': 'FixedString(20)', 'lifecycle__date_registration': 'FixedString(20)', 'lifecycle__date_rollout': 'FixedString(20)', 'model__classification': "Enum('UNKNOWN')", 'model__engine_count': 'Nullable(UInt8)', 'model__engine_type': "Enum('JET', 'TURBOFAN', 'TURBOPROP', 'UNKNOWN')", 'model__family': 'Nullable(String)', 'model__line_number': 'Nullable(String)', 'model__model_code': 'Nullable(String)', 'model__serial_number': 'Nullable(String)', 'model__series': 'Nullable(String)', 'model__sub_family': 'Nullable(String)', 'model__type_iata': 'Nullable(String)', 'model__type_iata_code_long': 'FixedString(4)', 'model__type_iata_code_short': 'FixedString(3)', 'status': "Enum('ACTIVE', 'INACTIVE', 'UNKNOWN')"}#

column_name - column_type pairs

Type:

dict[str, str]

TABLE_KEYS: tuple[str] = ('identity__icao24', 'identity__registration')#

keys used in database table

Type:

tuple[str]

TABLE_NAME = 'aircraft'#

name of aircraft table

Type:

str