Skip to content

tables

sc_crawler.tables #

Table definitions for vendors, regions, zones, and other cloud resources.

Country #

Bases: CountryBase

Country and continent mapping.

Attributes:

Name Type Description
country_id str

Country code by ISO 3166 alpha-2.

continent str

Continent name.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class Country(CountryBase, table=True):
    """Country and continent mapping."""

    vendors: List["Vendor"] = Relationship(back_populates="country")
    regions: List["Region"] = Relationship(back_populates="country")

ComplianceFramework #

Bases: ComplianceFrameworkBase

List of Compliance Frameworks, such as HIPAA or SOC 2 Type 1.

Attributes:

Name Type Description
compliance_framework_id str

Unique identifier.

name str

Human-friendly name.

abbreviation Optional[str]

Short abbreviation of the Framework name.

description Optional[str]

Description of the framework in a few paragrahs, outlining key features and characteristics for reference.

logo Optional[str]

Publicly accessible URL to the image of the Framework's logo.

homepage Optional[str]

Public homepage with more information on the Framework.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class ComplianceFramework(ComplianceFrameworkBase, table=True):
    """List of Compliance Frameworks, such as HIPAA or SOC 2 Type 1."""

    vendor_links: List["VendorComplianceLink"] = Relationship(
        back_populates="compliance_framework"
    )

Vendor #

Bases: VendorBase

Compute resource vendors, such as cloud and server providers.

Examples:
    >>> from sc_crawler.tables import Vendor
    >>> from sc_crawler.lookup import countries
    >>> aws = Vendor(vendor_id='aws', name='Amazon Web Services', homepage='https://aws.amazon.com', country=countries["US"], founding_year=2002)
    >>> aws
    Vendor(vendor_id='aws'...
    >>> from sc_crawler import vendors
    >>> vendors.aws
    Vendor(vendor_id='aws'...

Attributes:

Name Type Description
vendor_id str

Unique identifier.

name str

Human-friendly name.

logo Optional[str]

Publicly accessible URL to the image of the Vendor's logo.

homepage Optional[str]

Public homepage of the Vendor.

country_id str

Reference to the Country, where the Vendor's main headquarter is located.

state Optional[str]

Optional state/administrative area of the Vendor's location within the Country.

city Optional[str]

Optional city name of the Vendor's main location.

address_line Optional[str]

Optional address line of the Vendor's main location.

zip_code Optional[str]

Optional ZIP code of the Vendor's main location.

founding_year int

4-digit year when the Vendor was founded.

status_page Optional[str]

Public status page of the Vendor.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class Vendor(VendorBase, table=True):
    """Compute resource vendors, such as cloud and server providers.

    Examples:
        >>> from sc_crawler.tables import Vendor
        >>> from sc_crawler.lookup import countries
        >>> aws = Vendor(vendor_id='aws', name='Amazon Web Services', homepage='https://aws.amazon.com', country=countries["US"], founding_year=2002)
        >>> aws
        Vendor(vendor_id='aws'...
        >>> from sc_crawler import vendors
        >>> vendors.aws
        Vendor(vendor_id='aws'...
    """  # noqa: E501

    compliance_framework_links: List["VendorComplianceLink"] = Relationship(
        back_populates="vendor"
    )
    country: Country = Relationship(back_populates="vendors")
    regions: List["Region"] = Relationship(
        back_populates="vendor", sa_relationship_kwargs={"viewonly": True}
    )
    zones: List["Zone"] = Relationship(
        back_populates="vendor", sa_relationship_kwargs={"viewonly": True}
    )
    storages: List["Storage"] = Relationship(
        back_populates="vendor", sa_relationship_kwargs={"viewonly": True}
    )
    servers: List["Server"] = Relationship(
        back_populates="vendor", sa_relationship_kwargs={"viewonly": True}
    )
    server_prices: List["ServerPrice"] = Relationship(
        back_populates="vendor", sa_relationship_kwargs={"viewonly": True}
    )
    traffic_prices: List["TrafficPrice"] = Relationship(
        back_populates="vendor", sa_relationship_kwargs={"viewonly": True}
    )
    ipv4_prices: List["Ipv4Price"] = Relationship(
        back_populates="vendor", sa_relationship_kwargs={"viewonly": True}
    )
    storage_prices: List["StoragePrice"] = Relationship(
        back_populates="vendor", sa_relationship_kwargs={"viewonly": True}
    )
    benchmark_scores: List["BenchmarkScore"] = Relationship(
        back_populates="vendor", sa_relationship_kwargs={"viewonly": True}
    )

    # private attributes
    _methods: Optional[ImportString[ModuleType]] = PrivateAttr(default=None)
    _session: Optional[Session] = PrivateAttr()
    _progress_tracker: Optional[VendorProgressTracker] = PrivateAttr(
        default=VoidProgressTracker()
    )

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        # SQLModel does not validates pydantic typing,
        # only when writing to DB (much later in the process)
        if not self.vendor_id:
            raise ValueError("No vendor id provided")
        if not self.name:
            raise ValueError("No vendor name provided")
        if not self.homepage:
            raise ValueError("No vendor homepage provided")
        if not self.country:
            raise ValueError("No vendor country provided")
        # make sure methods are provided
        methods = self._get_methods().__dir__()
        for method in [
            "inventory_compliance_frameworks",
            "inventory_regions",
            "inventory_zones",
            "inventory_servers",
            "inventory_server_prices",
            "inventory_server_prices_spot",
            "inventory_storage_prices",
            "inventory_traffic_prices",
            "inventory_ipv4_prices",
        ]:
            if method not in methods:
                raise NotImplementedError(
                    f"Unsupported '{self.vendor_id}' vendor: missing '{method}' method."
                )

    def _get_methods(self):
        # private attributes are not (always) initialized correctly by SQLmodel
        # e.g. the attribute is missing alltogether when loaded from DB
        # https://github.com/tiangolo/sqlmodel/issues/149
        try:
            hasattr(self, "_methods")
        except Exception:
            self._methods = None
        if not self._methods:
            try:
                vendor_module = ".".join(
                    [__name__.split(".", maxsplit=1)[0], "vendors", self.vendor_id]
                )
                self._methods = import_module(vendor_module)
            except Exception as exc:
                raise NotImplementedError(
                    f"Unsupported '{self.vendor_id}' vendor: no methods defined."
                ) from exc
        return self._methods

    @property
    def session(self):
        """The Session to use for merging dependent objects into the database."""
        try:
            return self._session
        except Exception:
            return None

    @session.setter
    def session(self, session: Session):
        self._session = session

    @session.deleter
    def session(self):
        self._session = None

    @property
    def progress_tracker(self):
        """The [sc_crawler.logger.VendorProgressTracker][] to use for updating progress bars."""
        return self._progress_tracker

    @progress_tracker.setter
    def progress_tracker(self, progress_tracker: VendorProgressTracker):
        self._progress_tracker = progress_tracker

    @progress_tracker.deleter
    def progress_tracker(self):
        self._progress_tracker = None

    @property
    def tasks(self):
        """Reexport progress_tracker.tasks for easier access."""
        return self._progress_tracker.tasks

    def log(self, message: str, level: int = logging.INFO):
        logger.log(level, self.name + ": " + message, stacklevel=2)

    def set_table_rows_inactive(self, model: str, *args) -> None:
        """Set this vendor's records to [INACTIVE][sc_crawler.table_fields.Status] in a table.

        Positional arguments can be used to pass further filters
        (besides the default model.vendor_id filter) referencing the
        model object with SQLModel syntax.

        Examples:
            >>> aws.set_table_rows_inactive(ServerPrice, ServerPrice.price < 10)  # doctest: +SKIP
        """
        if self.session:
            query = update(model).where(model.vendor_id == self.vendor_id)
            for arg in args:
                query = query.where(arg)
            self.session.execute(query.values(status=Status.INACTIVE))

    def _inventory(self, table: ScModel, inventory: Callable):
        """Mark all rows in a table inactive, then insert new/updated items."""
        self.set_table_rows_inactive(table)
        insert_items(table, inventory(self), self)

    @log_start_end
    def inventory_compliance_frameworks(self):
        """Get the vendor's all compliance frameworks."""
        self._inventory(
            VendorComplianceLink, self._get_methods().inventory_compliance_frameworks
        )

    @log_start_end
    def inventory_regions(self):
        """Get the vendor's all regions."""
        self._inventory(Region, self._get_methods().inventory_regions)

    @log_start_end
    def inventory_zones(self):
        """Get all the zones in the vendor's regions."""
        self._inventory(Zone, self._get_methods().inventory_zones)

    @log_start_end
    def inventory_servers(self):
        """Get the vendor's all server types."""
        self.set_table_rows_inactive(Server)
        servers = self._get_methods().inventory_servers(self)
        # show progress bar while downloading
        self.progress_tracker.start_task(
            name="Downloading sc-inspector-data", total=None
        )
        inspector_data_path()
        self.progress_tracker.hide_task()
        # actual HW inspection
        for server in servers:
            server = inspect_update_server_dict(server)
        insert_items(Server, servers, self)
        benchmarks = []
        self.progress_tracker.start_task(
            name="Searching for benchmark(s)", total=len(self.servers)
        )
        for server in self.servers:
            benchmarks += inspect_server_benchmarks(server)
            self.progress_tracker.advance_task()
        self.progress_tracker.hide_task()
        self.set_table_rows_inactive(
            BenchmarkScore, BenchmarkScore.vendor_id == self.vendor_id
        )
        insert_items(BenchmarkScore, benchmarks, self)

    @log_start_end
    def inventory_server_prices(self):
        """Get the current standard/ondemand/reserved prices of all server types."""
        self.set_table_rows_inactive(
            ServerPrice, ServerPrice.allocation != Allocation.SPOT
        )
        insert_items(
            ServerPrice,
            self._get_methods().inventory_server_prices(self),
            self,
            prefix="ondemand",
        )

    @log_start_end
    def inventory_server_prices_spot(self):
        """Get the current spot prices of all server types."""
        self.set_table_rows_inactive(
            ServerPrice, ServerPrice.allocation == Allocation.SPOT
        )
        insert_items(
            ServerPrice,
            self._get_methods().inventory_server_prices_spot(self),
            self,
            prefix="spot",
        )

    @log_start_end
    def inventory_storages(self):
        self._inventory(Storage, self._get_methods().inventory_storages)

    @log_start_end
    def inventory_storage_prices(self):
        self._inventory(StoragePrice, self._get_methods().inventory_storage_prices)

    @log_start_end
    def inventory_traffic_prices(self):
        self._inventory(TrafficPrice, self._get_methods().inventory_traffic_prices)

    @log_start_end
    def inventory_ipv4_prices(self):
        self._inventory(Ipv4Price, self._get_methods().inventory_ipv4_prices)

session deletable property writable #

session

The Session to use for merging dependent objects into the database.

progress_tracker deletable property writable #

progress_tracker

The sc_crawler.logger.VendorProgressTracker to use for updating progress bars.

tasks property #

tasks

Reexport progress_tracker.tasks for easier access.

set_table_rows_inactive #

set_table_rows_inactive(model, *args)

Set this vendor's records to INACTIVE in a table.

Positional arguments can be used to pass further filters (besides the default model.vendor_id filter) referencing the model object with SQLModel syntax.

Examples:

>>> aws.set_table_rows_inactive(ServerPrice, ServerPrice.price < 10)
Source code in sc_crawler/tables.py
def set_table_rows_inactive(self, model: str, *args) -> None:
    """Set this vendor's records to [INACTIVE][sc_crawler.table_fields.Status] in a table.

    Positional arguments can be used to pass further filters
    (besides the default model.vendor_id filter) referencing the
    model object with SQLModel syntax.

    Examples:
        >>> aws.set_table_rows_inactive(ServerPrice, ServerPrice.price < 10)  # doctest: +SKIP
    """
    if self.session:
        query = update(model).where(model.vendor_id == self.vendor_id)
        for arg in args:
            query = query.where(arg)
        self.session.execute(query.values(status=Status.INACTIVE))

inventory_compliance_frameworks #

inventory_compliance_frameworks()

Get the vendor's all compliance frameworks.

Source code in sc_crawler/tables.py
@log_start_end
def inventory_compliance_frameworks(self):
    """Get the vendor's all compliance frameworks."""
    self._inventory(
        VendorComplianceLink, self._get_methods().inventory_compliance_frameworks
    )

inventory_regions #

inventory_regions()

Get the vendor's all regions.

Source code in sc_crawler/tables.py
@log_start_end
def inventory_regions(self):
    """Get the vendor's all regions."""
    self._inventory(Region, self._get_methods().inventory_regions)

inventory_zones #

inventory_zones()

Get all the zones in the vendor's regions.

Source code in sc_crawler/tables.py
@log_start_end
def inventory_zones(self):
    """Get all the zones in the vendor's regions."""
    self._inventory(Zone, self._get_methods().inventory_zones)

inventory_servers #

inventory_servers()

Get the vendor's all server types.

Source code in sc_crawler/tables.py
@log_start_end
def inventory_servers(self):
    """Get the vendor's all server types."""
    self.set_table_rows_inactive(Server)
    servers = self._get_methods().inventory_servers(self)
    # show progress bar while downloading
    self.progress_tracker.start_task(
        name="Downloading sc-inspector-data", total=None
    )
    inspector_data_path()
    self.progress_tracker.hide_task()
    # actual HW inspection
    for server in servers:
        server = inspect_update_server_dict(server)
    insert_items(Server, servers, self)
    benchmarks = []
    self.progress_tracker.start_task(
        name="Searching for benchmark(s)", total=len(self.servers)
    )
    for server in self.servers:
        benchmarks += inspect_server_benchmarks(server)
        self.progress_tracker.advance_task()
    self.progress_tracker.hide_task()
    self.set_table_rows_inactive(
        BenchmarkScore, BenchmarkScore.vendor_id == self.vendor_id
    )
    insert_items(BenchmarkScore, benchmarks, self)

inventory_server_prices #

inventory_server_prices()

Get the current standard/ondemand/reserved prices of all server types.

Source code in sc_crawler/tables.py
@log_start_end
def inventory_server_prices(self):
    """Get the current standard/ondemand/reserved prices of all server types."""
    self.set_table_rows_inactive(
        ServerPrice, ServerPrice.allocation != Allocation.SPOT
    )
    insert_items(
        ServerPrice,
        self._get_methods().inventory_server_prices(self),
        self,
        prefix="ondemand",
    )

inventory_server_prices_spot #

inventory_server_prices_spot()

Get the current spot prices of all server types.

Source code in sc_crawler/tables.py
@log_start_end
def inventory_server_prices_spot(self):
    """Get the current spot prices of all server types."""
    self.set_table_rows_inactive(
        ServerPrice, ServerPrice.allocation == Allocation.SPOT
    )
    insert_items(
        ServerPrice,
        self._get_methods().inventory_server_prices_spot(self),
        self,
        prefix="spot",
    )

Bases: VendorComplianceLinkBase

List of known Compliance Frameworks paired with vendors.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

compliance_framework_id str

Reference to the Compliance Framework.

comment Optional[str]

Optional references, such as dates, URLs, and additional information/evidence.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class VendorComplianceLink(VendorComplianceLinkBase, table=True):
    """List of known Compliance Frameworks paired with vendors."""

    vendor: Vendor = Relationship(back_populates="compliance_framework_links")
    compliance_framework: ComplianceFramework = Relationship(
        back_populates="vendor_links"
    )

Region #

Bases: RegionBase

Regions of Vendors.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

region_id str

Unique identifier, as called at the Vendor.

name str

Human-friendly name.

api_reference str

How this resource is referenced in the vendor API calls. This is usually either the id or name of the resource, depening on the vendor and actual API endpoint.

display_name str

Human-friendly reference (usually the id or name) of the resource.

aliases List[str]

List of other commonly used names for the same Region.

country_id str

Reference to the Country, where the Region is located.

state Optional[str]

Optional state/administrative area of the Region's location within the Country.

city Optional[str]

Optional city name of the Region's location.

address_line Optional[str]

Optional address line of the Region's location.

zip_code Optional[str]

Optional ZIP code of the Region's location.

lon Optional[float]

Longitude coordinate of the Region's known or approximate location.

lat Optional[float]

Latitude coordinate of the Region's known or approximate location.

founding_year Optional[int]

4-digit year when the Region was founded.

green_energy Optional[bool]

If the Region is 100% powered by renewable energy.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class Region(RegionBase, table=True):
    """Regions of Vendors."""

    vendor: Vendor = Relationship(back_populates="regions")
    country: Country = Relationship(back_populates="regions")

    zones: List["Zone"] = Relationship(
        back_populates="region", sa_relationship_kwargs={"viewonly": True}
    )
    server_prices: List["ServerPrice"] = Relationship(
        back_populates="region", sa_relationship_kwargs={"viewonly": True}
    )
    traffic_prices: List["TrafficPrice"] = Relationship(
        back_populates="region", sa_relationship_kwargs={"viewonly": True}
    )
    ipv4_prices: List["Ipv4Price"] = Relationship(
        back_populates="region", sa_relationship_kwargs={"viewonly": True}
    )
    storage_prices: List["StoragePrice"] = Relationship(
        back_populates="region", sa_relationship_kwargs={"viewonly": True}
    )

Zone #

Bases: ZoneBase

Availability zones of Regions.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

region_id str

Reference to the Region.

zone_id str

Unique identifier, as called at the Vendor.

name str

Human-friendly name.

api_reference str

How this resource is referenced in the vendor API calls. This is usually either the id or name of the resource, depening on the vendor and actual API endpoint.

display_name str

Human-friendly reference (usually the id or name) of the resource.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class Zone(ZoneBase, table=True):
    """Availability zones of Regions."""

    __table_args__ = (
        ForeignKeyConstraint(
            ["vendor_id", "region_id"],
            ["region.vendor_id", "region.region_id"],
        ),
    )

    region: Region = Relationship(
        back_populates="zones",
        sa_relationship_kwargs={
            "primaryjoin": (
                "and_(Region.region_id == foreign(Zone.region_id), "
                "Region.vendor_id == foreign(Zone.vendor_id))"
            ),
            "overlaps": "vendor",
        },
    )
    vendor: Vendor = Relationship(back_populates="zones")

    server_prices: List["ServerPrice"] = Relationship(
        back_populates="zone", sa_relationship_kwargs={"viewonly": True}
    )

Storage #

Bases: StorageBase

Flexible storage options that can be attached to a Server.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

storage_id str

Unique identifier, as called at the Vendor.

name str

Human-friendly name.

description Optional[str]

Short description.

storage_type StorageType

High-level category of the storage, e.g. HDD or SDD.

max_iops Optional[int]

Maximum Input/Output Operations Per Second.

max_throughput Optional[int]

Maximum Throughput (MiB/s).

min_size Optional[int]

Minimum required size (GiB).

max_size Optional[int]

Maximum possible size (GiB).

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class Storage(StorageBase, table=True):
    """Flexible storage options that can be attached to a Server."""

    vendor: Vendor = Relationship(back_populates="storages")

    prices: List["StoragePrice"] = Relationship(
        back_populates="storage", sa_relationship_kwargs={"viewonly": True}
    )

Server #

Bases: ServerBase

Server types.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

server_id str

Unique identifier, as called at the Vendor.

name str

Human-friendly name.

api_reference str

How this resource is referenced in the vendor API calls. This is usually either the id or name of the resource, depening on the vendor and actual API endpoint.

display_name str

Human-friendly reference (usually the id or name) of the resource.

description Optional[str]

Short description.

family Optional[str]

Server family, e.g. General-purpose machine (GCP), or M5g (AWS).

vcpus int

Default number of virtual CPUs (vCPU) of the server.

hypervisor Optional[str]

Hypervisor of the virtual server, e.g. Xen, KVM, Nitro or Dedicated.

cpu_allocation CpuAllocation

Allocation of CPU(s) to the server, e.g. shared, burstable or dedicated.

cpu_cores Optional[int]

Default number of CPU cores of the server. Equals to vCPUs when HyperThreading is disabled.

cpu_speed Optional[float]

Vendor-reported maximum CPU clock speed (GHz).

cpu_architecture CpuArchitecture

CPU architecture (arm64, arm64_mac, i386, or x86_64).

cpu_manufacturer Optional[str]

The manufacturer of the primary processor, e.g. Intel or AMD.

cpu_family Optional[str]

The product line/family of the primary processor, e.g. Xeon, Core i7, Ryzen 9.

cpu_model Optional[str]

The model number of the primary processor, e.g. 9750H.

cpu_l1_cache Optional[int]

L1 cache size (byte).

cpu_l2_cache Optional[int]

L2 cache size (byte).

cpu_l3_cache Optional[int]

L3 cache size (byte).

cpu_flags List[str]

CPU features/flags.

cpus List[Cpu]

JSON array of known CPU details, e.g. the manufacturer, family, model; L1/L2/L3 cache size; microcode version; feature flags; bugs etc.

memory_amount int

RAM amount (MiB).

memory_generation Optional[DdrGeneration]

Generation of the DDR SDRAM, e.g. DDR4 or DDR5.

memory_speed Optional[int]

DDR SDRAM clock rate (Mhz).

memory_ecc Optional[bool]

If the DDR SDRAM uses error correction code to detect and correct n-bit data corruption.

gpu_count int

Number of GPU accelerator(s).

gpu_memory_min Optional[int]

Memory (MiB) allocated to the lowest-end GPU accelerator.

gpu_memory_total Optional[int]

Overall memory (MiB) allocated to all the GPU accelerator(s).

gpu_manufacturer Optional[str]

The manufacturer of the primary GPU accelerator, e.g. Nvidia or AMD.

gpu_family Optional[str]

The product family of the primary GPU accelerator, e.g. Turing.

gpu_model Optional[str]

The model number of the primary GPU accelerator, e.g. Tesla T4.

gpus List[Gpu]

JSON array of GPU accelerator details, including the manufacturer, name, and memory (MiB) of each GPU.

storage_size int

Overall size (GB) of the disk(s).

storage_type Optional[StorageType]

Primary disk type, e.g. HDD, SSD, NVMe SSD, or network).

storages List[Disk]

JSON array of disks attached to the server, including the size (MiB) and type of each disk.

network_speed Optional[float]

The baseline network performance (Gbps) of the network card.

inbound_traffic float

Amount of complimentary inbound traffic (GB) per month.

outbound_traffic float

Amount of complimentary outbound traffic (GB) per month.

ipv4 int

Number of complimentary IPv4 address(es).

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class Server(ServerBase, table=True):
    """Server types."""

    vendor: Vendor = Relationship(back_populates="servers")
    prices: List["ServerPrice"] = Relationship(
        back_populates="server", sa_relationship_kwargs={"viewonly": True}
    )
    benchmark_scores: List["BenchmarkScore"] = Relationship(
        back_populates="server", sa_relationship_kwargs={"viewonly": True}
    )

ServerPrice #

Bases: ServerPriceBase

Server type prices per Region and Allocation method.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

region_id str

Reference to the Region.

zone_id str

Reference to the Zone.

server_id str

Reference to the Server.

operating_system str

Operating System.

allocation Allocation

Allocation method, e.g. on-demand or spot.

unit PriceUnit

Billing unit of the pricing model.

price float

Actual price of a billing unit.

price_upfront float

Price to be paid when setting up the resource.

price_tiered List[PriceTier]

List of pricing tiers with min/max thresholds and actual prices.

currency str

Currency of the prices.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class ServerPrice(ServerPriceBase, table=True):
    """Server type prices per Region and Allocation method."""

    __table_args__ = (
        ForeignKeyConstraint(
            ["vendor_id", "region_id"],
            ["region.vendor_id", "region.region_id"],
        ),
        ForeignKeyConstraint(
            ["vendor_id", "region_id", "zone_id"],
            ["zone.vendor_id", "zone.region_id", "zone.zone_id"],
        ),
        ForeignKeyConstraint(
            ["vendor_id", "server_id"],
            ["server.vendor_id", "server.server_id"],
        ),
    )
    vendor: Vendor = Relationship(back_populates="server_prices")
    region: Region = Relationship(
        back_populates="server_prices",
        sa_relationship_kwargs={
            "primaryjoin": (
                "and_(Region.region_id == foreign(ServerPrice.region_id), "
                "Region.vendor_id == foreign(ServerPrice.vendor_id))"
            ),
            "overlaps": "vendor,zone,server",
        },
    )
    zone: Zone = Relationship(
        back_populates="server_prices",
        sa_relationship_kwargs={
            "primaryjoin": (
                "and_(Zone.zone_id == foreign(ServerPrice.zone_id), "
                "Zone.region_id == foreign(ServerPrice.region_id),"
                "Zone.vendor_id == foreign(ServerPrice.vendor_id))"
            ),
            "overlaps": "vendor,region,server",
        },
    )
    server: Server = Relationship(
        back_populates="prices",
        sa_relationship_kwargs={
            "primaryjoin": (
                "and_(Server.server_id == foreign(ServerPrice.server_id), "
                "Server.vendor_id == foreign(ServerPrice.vendor_id))"
            ),
            "overlaps": "vendor,region,zone",
        },
    )

StoragePrice #

Bases: StoragePriceBase

Flexible Storage prices in each Region.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

region_id str

Reference to the Region.

storage_id str

Reference to the Storage.

unit PriceUnit

Billing unit of the pricing model.

price float

Actual price of a billing unit.

price_upfront float

Price to be paid when setting up the resource.

price_tiered List[PriceTier]

List of pricing tiers with min/max thresholds and actual prices.

currency str

Currency of the prices.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class StoragePrice(StoragePriceBase, table=True):
    """Flexible Storage prices in each Region."""

    __table_args__ = (
        ForeignKeyConstraint(
            ["vendor_id", "region_id"],
            ["region.vendor_id", "region.region_id"],
        ),
        ForeignKeyConstraint(
            ["vendor_id", "storage_id"],
            ["storage.vendor_id", "storage.storage_id"],
        ),
    )
    vendor: Vendor = Relationship(back_populates="storage_prices")
    region: Region = Relationship(
        back_populates="storage_prices",
        sa_relationship_kwargs={
            "primaryjoin": (
                "and_(Region.region_id == foreign(StoragePrice.region_id),"
                "Region.vendor_id == foreign(StoragePrice.vendor_id))"
            ),
            "overlaps": "vendor,storage",
        },
    )
    storage: Storage = Relationship(
        back_populates="prices",
        sa_relationship_kwargs={
            "primaryjoin": (
                "and_(Storage.storage_id == foreign(StoragePrice.storage_id), "
                "Storage.vendor_id == foreign(StoragePrice.vendor_id))"
            ),
            "overlaps": "vendor,region",
        },
    )

TrafficPrice #

Bases: TrafficPriceBase

Extra Traffic prices in each Region.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

region_id str

Reference to the Region.

direction TrafficDirection

Direction of the traffic: inbound or outbound.

unit PriceUnit

Billing unit of the pricing model.

price float

Actual price of a billing unit.

price_upfront float

Price to be paid when setting up the resource.

price_tiered List[PriceTier]

List of pricing tiers with min/max thresholds and actual prices.

currency str

Currency of the prices.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class TrafficPrice(TrafficPriceBase, table=True):
    """Extra Traffic prices in each Region."""

    __table_args__ = (
        ForeignKeyConstraint(
            ["vendor_id", "region_id"],
            ["region.vendor_id", "region.region_id"],
        ),
    )
    vendor: Vendor = Relationship(back_populates="traffic_prices")
    region: Region = Relationship(
        back_populates="traffic_prices",
        sa_relationship_kwargs={
            "primaryjoin": (
                "and_(Region.region_id == foreign(TrafficPrice.region_id),"
                "Region.vendor_id == foreign(TrafficPrice.vendor_id))"
            ),
            "overlaps": "vendor",
        },
    )

Ipv4Price #

Bases: Ipv4PriceBase

Price of an IPv4 address in each Region.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

region_id str

Reference to the Region.

unit PriceUnit

Billing unit of the pricing model.

price float

Actual price of a billing unit.

price_upfront float

Price to be paid when setting up the resource.

price_tiered List[PriceTier]

List of pricing tiers with min/max thresholds and actual prices.

currency str

Currency of the prices.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class Ipv4Price(Ipv4PriceBase, table=True):
    """Price of an IPv4 address in each Region."""

    __table_args__ = (
        ForeignKeyConstraint(
            ["vendor_id", "region_id"],
            ["region.vendor_id", "region.region_id"],
        ),
    )
    vendor: Vendor = Relationship(back_populates="ipv4_prices")
    region: Region = Relationship(
        back_populates="ipv4_prices",
        sa_relationship_kwargs={
            "primaryjoin": (
                "and_(Region.region_id == foreign(Ipv4Price.region_id),"
                "Region.vendor_id == foreign(Ipv4Price.vendor_id))"
            ),
            "overlaps": "vendor",
        },
    )

Benchmark #

Bases: BenchmarkBase

Benchmark scenario definitions.

Attributes:

Name Type Description
benchmark_id str

Unique identifier of a specific Benchmark.

name str

Human-friendly name.

description Optional[str]

Short description.

framework str

The name of the benchmark framework/software/tool used.

config_fields dict

A dictionary of descriptions on the framework-specific config options, e.g. {"bandwidth": "Memory amount to use for compression in MB."}.

measurement Optional[str]

The name of measurement recoreded in the benchmark.

unit Optional[str]

Optional unit of measurement for the benchmark score.

higher_is_better bool

If higher benchmark score means better performance, or vica versa.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class Benchmark(BenchmarkBase, table=True):
    """Benchmark scenario definitions."""

    benchmark_scores: List["BenchmarkScore"] = Relationship(
        back_populates="benchmark", sa_relationship_kwargs={"viewonly": True}
    )

BenchmarkScore #

Bases: BenchmarkScoreBase

Results of running Benchmark scenarios on Servers.

Attributes:

Name Type Description
vendor_id str

Reference to the Vendor.

server_id str

Reference to the Server.

benchmark_id str

Reference to the Benchmark.

config HashableDict | dict

Dictionary of config parameters of the specific benchmark, e.g. {"bandwidth": 4096}

score float

The resulting score of the benchmark.

note Optional[str]

Optional note, comment or context on the benchmark score.

status Status

Status of the resource (active or inactive).

observed_at datetime

Timestamp of the last observation.

Source code in sc_crawler/tables.py
class BenchmarkScore(BenchmarkScoreBase, table=True):
    """Results of running Benchmark scenarios on Servers."""

    __table_args__ = (
        ForeignKeyConstraint(
            ["vendor_id", "server_id"],
            ["server.vendor_id", "server.server_id"],
        ),
    )
    vendor: Vendor = Relationship(back_populates="benchmark_scores")
    server: Server = Relationship(
        back_populates="benchmark_scores",
        sa_relationship_kwargs={
            "primaryjoin": (
                "and_(Server.server_id == foreign(BenchmarkScore.server_id), "
                "Server.vendor_id == foreign(BenchmarkScore.vendor_id))"
            ),
            "overlaps": "vendor",
        },
    )
    benchmark: Benchmark = Relationship(back_populates="benchmark_scores")

tables module-attribute #

tables = [o for o in values() if is_table(o)]

List of all SQLModel (table) models.