Skip to main content

sc_crawler.tables

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

Classes:

  • Country – Country and continent mapping.
  • ComplianceFramework – List of Compliance Frameworks, such as HIPAA or SOC 2 Type 1.
  • Vendor – Compute resource vendors, such as cloud and server providers.
  • VendorComplianceLink – List of known Compliance Frameworks paired with vendors.
  • Region – Regions of Vendors.
  • Zone – Availability zones of Regions.
  • Storage – Flexible storage options that can be attached to a Server.
  • Server – Server types.
  • ServerPrice – Server type prices per Region and Allocation method.
  • ServerDescription – Variable length, plain English descriptions of Server hardware specs, performance, cost-efficiency, and workflow fit.
  • StoragePrice – Flexible Storage prices in each Region.
  • Database – Managed database SKUsSKU: Stock Keeping UnitAn identifier of a product a vendor sells, e.g. a server type, or a component that its price is built from, such as a vCPU or a GB of memory in a region. Cloud vendors' price lists are made of SKUs, which the Crawler combines into the price of each server type.Glossary.
  • DatabasePrice – Managed database SKU prices per Region.
  • DatabaseStorage – Managed database storage products.
  • DatabaseStoragePrice – Managed database storage prices in each Region.
  • TrafficPrice – Extra Traffic prices in each Region.
  • Ipv4Price – Price of an IPv4 address in each Region.
  • Benchmark – Benchmark scenario definitions.
  • BenchmarkScore – Results of running Benchmark scenarios on Servers or managed Databases.
  • ArchiveRule – Rules archiving records that were replaced by another record or deliberately dropped.
  • Metadata – Key/value metadata table for database release information.

Functions:

  • is_table – Checks if an object is a SQLModel table definition.

Attributes:

class Country tables.py:63–67⁠ (opens in a new tab)​

Bases: CountryBase

Country and continent mapping.

Attributes:

class ComplianceFramework tables.py:70–75⁠ (opens in a new tab)​

Bases: ComplianceFrameworkBase

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

Attributes:

class Vendor tables.py:78–477⁠ (opens in a new tab)​

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:

Functions:

attr Vendor.session tables.py:195–200⁠ (opens in a new tab)​

session

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

attr Vendor.progress_tracker tables.py:211–213⁠ (opens in a new tab)​

progress_tracker

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

attr Vendor.tasks tables.py:224–226⁠ (opens in a new tab)​

tasks

Reexport progress_tracker.tasks for easier access.

meth Vendor.set_table_rows_inactive tables.py:231–262⁠ (opens in a new tab)​

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.

Records marked as ARCHIVED are kept as-is, just like the PLANNED_FOR_RETIREMENT and RETIRED servers and databases, so that these keep their status and retirement date when no longer returned by the vendor.

Examples:

>>> aws.set_table_rows_inactive(ServerPrice, ServerPrice.price < 10)

meth Vendor.set_table_rows_active tables.py:264–284⁠ (opens in a new tab)​

set_table_rows_active(model, *args)

Set this vendor's records to ACTIVE 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.

Records marked as ARCHIVED are kept as-is.

Examples:

>>> aws.set_table_rows_active(ServerPrice, ServerPrice.price < 10)

meth Vendor.inventory_compliance_frameworks tables.py:315–320⁠ (opens in a new tab)​

inventory_compliance_frameworks()

Get the vendor's all compliance frameworks.

meth Vendor.inventory_regions tables.py:322–325⁠ (opens in a new tab)​

inventory_regions()

Get the vendor's all regions.

meth Vendor.inventory_zones tables.py:327–330⁠ (opens in a new tab)​

inventory_zones()

Get all the zones in the vendor's regions.

meth Vendor.inventory_servers tables.py:332–379⁠ (opens in a new tab)​

inventory_servers()

Get the vendor's all server types.

meth Vendor.inventory_server_prices tables.py:381–389⁠ (opens in a new tab)​

inventory_server_prices()

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

meth Vendor.inventory_server_prices_spot tables.py:391–399⁠ (opens in a new tab)​

inventory_server_prices_spot()

Get the current spot prices of all server types.

meth Vendor.inventory_storages tables.py:401–404⁠ (opens in a new tab)​

inventory_storages()

Get the vendor's all storage types.

meth Vendor.inventory_storage_prices tables.py:406–411⁠ (opens in a new tab)​

inventory_storage_prices()

Get the current prices of all storage types.

meth Vendor.inventory_traffic_prices tables.py:413–418⁠ (opens in a new tab)​

inventory_traffic_prices()

Get the current prices of all traffic types.

meth Vendor.inventory_ipv4_prices tables.py:420–425⁠ (opens in a new tab)​

inventory_ipv4_prices()

Get the current prices of all IPv4 types.

meth Vendor.inventory_databases tables.py:427–452⁠ (opens in a new tab)​

inventory_databases()

Get the vendor's all managed database types.

meth Vendor.inventory_database_prices tables.py:454–462⁠ (opens in a new tab)​

inventory_database_prices()

Get the current prices of all managed database types.

meth Vendor.inventory_database_storages tables.py:464–469⁠ (opens in a new tab)​

inventory_database_storages()

Get the vendor's all managed database storage products.

meth Vendor.inventory_database_storage_prices tables.py:471–477⁠ (opens in a new tab)​

inventory_database_storage_prices()

Get the current prices of all managed database storage products.

Bases: VendorComplianceLinkBase

List of known Compliance Frameworks paired with vendors.

Attributes:

class Region tables.py:489–515⁠ (opens in a new tab)​

Bases: RegionBase

Regions of Vendors.

Attributes:

class Zone tables.py:518–542⁠ (opens in a new tab)​

Bases: ZoneBase

Availability zones of Regions.

Attributes:

class Storage tables.py:545–552⁠ (opens in a new tab)​

Bases: StorageBase

Flexible storage options that can be attached to a Server.

Attributes:

class Server tables.py:555–576⁠ (opens in a new tab)​

Bases: ServerBase

Server types.

Attributes:

Functions:

meth Server.check_inspector_task_block_reasons tables.py:558–560⁠ (opens in a new tab)​

check_inspector_task_block_reasons(tasks)

Check if the Server should run inspector task(s) and return block reasons.

class ServerPrice tables.py:579–627⁠ (opens in a new tab)​

Bases: ServerPriceBase

Server type prices per Region and Allocation method.

Attributes:

class ServerDescription tables.py:630–638⁠ (opens in a new tab)​

Bases: ServerDescriptionBase

Variable length, plain English descriptions of Server hardware specs, performance, cost-efficiency, and workflow fit.

Attributes:

class StoragePrice tables.py:641–674⁠ (opens in a new tab)​

Bases: StoragePriceBase

Flexible Storage prices in each Region.

Attributes:

class Database tables.py:677–698⁠ (opens in a new tab)​

Bases: DatabaseBase

Managed database SKUs.

Attributes:

Functions:

meth Database.check_inspector_task_block_reasons tables.py:680–682⁠ (opens in a new tab)​

check_inspector_task_block_reasons(tasks)

Check if the Database should run inspector task(s) and return block reasons.

class DatabasePrice tables.py:701–734⁠ (opens in a new tab)​

Bases: DatabasePriceBase

Managed database SKU prices per Region.

Attributes:

class DatabaseStorage tables.py:737–744⁠ (opens in a new tab)​

Bases: DatabaseStorageBase

Managed database storage products.

Attributes:

class DatabaseStoragePrice tables.py:747–782⁠ (opens in a new tab)​

Bases: DatabaseStoragePriceBase

Managed database storage prices in each Region.

Attributes:

class TrafficPrice tables.py:785–804⁠ (opens in a new tab)​

Bases: TrafficPriceBase

Extra Traffic prices in each Region.

Attributes:

class Ipv4Price tables.py:807–826⁠ (opens in a new tab)​

Bases: Ipv4PriceBase

Price of an IPv4 address in each Region.

Attributes:

class Benchmark tables.py:829–834⁠ (opens in a new tab)​

Bases: BenchmarkBase

Benchmark scenario definitions.

Attributes:

class BenchmarkScore tables.py:837–865⁠ (opens in a new tab)​

Bases: BenchmarkScoreBase

Results of running Benchmark scenarios on Servers or managed Databases.

Attributes:

class ArchiveRule tables.py:868–1055⁠ (opens in a new tab)​

Bases: ArchiveRuleBase

Rules archiving records that were replaced by another record or deliberately dropped.

The rules are defined in sc_crawler.archive_rules, and are applied by the pull and sync commands (see apply), which set the matched records and their child records to ARCHIVED.

Examples:

>>> from sc_crawler.tables import ArchiveRule
>>> ArchiveRule(table_name="benchmark", match={"benchmark_id": "foo"}, reason="Dropped.")
ArchiveRule(table_name='benchmark', match={'benchmark_id': 'foo'}, reason='Dropped.', successor={}...

Attributes:

Functions:

  • apply – Store the rules in the database, and archive the records they match.
  • find_unmatched – Describe the rules referring to records that are in none of the databases.
  • check – Check the definition of the rules, without a database.

meth ArchiveRule.apply tables.py:887–921⁠ (opens in a new tab)​

apply(session, rules=None)

Store the rules in the database, and archive the records they match.

All rules are written to the archive_rule table (also the ones not matching any record), then the matched records and their child records are set to ARCHIVED.

Parameters:

Returns:

meth ArchiveRule.find_unmatched tables.py:923–965⁠ (opens in a new tab)​

find_unmatched(sessions, table_names=None, rules=None)

Describe the rules referring to records that are in none of the databases.

Checks both the match and the (non-empty) successor of the rules, e.g. to find typos in the ids, or successors not provided by the vendor.

Parameters:

Returns:

meth ArchiveRule.check tables.py:967–1055⁠ (opens in a new tab)​

check(rules=None)

Check the definition of the rules, without a database.

Parameters:

Returns:

  • List⁠ (opens in a new tab)[str⁠ (opens in a new tab)] – Description of the problems found: unknown tables, match keys that are not primary key columns of the table, successor with other keys than match, enum columns not given by the value of a member, missing reason of rules without a successor, and rules leading back to a record they archived (cycles).

func is_table tables.py:1071–1076⁠ (opens in a new tab)​

is_table(table)

Checks if an object is a SQLModel table definition.

attr tables tables.py:1079⁠ (opens in a new tab)​

tables: List[SQLModel] = [o for o in globals().values() if is_table(o)]

List of all SQLModel (table) models.

class Metadata tables.py:1086–1091⁠ (opens in a new tab)​

Bases: SQLModel

Key/value metadata table for database release information.