Package: oddrn-generator
Open Data Discovery Resource Name GeneratorHelps generate oddrn for data sources.RequirementsInstallationAvailable generatorsGenerator propertiesGenerator methodsGenerator propertiesExample usageExceptionsDevelopmentRequirementsPython >= 3.7Installationpoetryaddoddrn-generator# orpipinstalloddrn-generatorUsage and configurationAvailable generatorsDataSourceGenerator class namecassandraCassandraGeneratorpostgresqlPostgresqlGeneratormysqlMysqlGeneratorglueGlueGenerators3S3GeneratorkafkaKafkaGeneratorkafkaconnectKafkaConnectGeneratorsnowflakeSnowflakeGeneratorairflowAirflowGeneratorhiveHiveGeneratordynamodbDynamodbGeneratorodbcOdbcGeneratormssqlMssqlGeneratororacleOracleGeneratorredshiftRedshiftGeneratorclickhouseClickHouseGeneratorathenaAthenaGeneratorquicksightQuicksightGeneratordbtDbtGeneratorprefectPrefectGeneratortableauTableauGeneratorneo4jNeo4jGeneratormongodbMongoGeneratorverticaVerticaGeneratorCubeJsCubeJsGeneratorsupersetSupersetGeneratorPrestoPrestoGeneratorTrinoTrinoGeneratordmsDmsGeneratorpowerbiPowerBiGeneratorGenerator propertiesbase_oddrn - Get base oddrn (without path)available_paths - Get all available path of generatorGenerator methodsget_oddrn_by_path(path_name, new_value=None) - Get oddrn string by path. You also can set value for this path using '
new_value' paramset_oddrn_paths(**kwargs) - Set or update values of oddrn pathget_data_source_oddrn() - Get data source oddrnGenerator parameters:host_settings: str - optional. Hostname configurationcloud_settings: dict - optional. Cloud configuration**kwargs - path's name and valuesExample usage# postgresqlfromoddrn_generatorimportPostgresqlGeneratoroddrn_gen=PostgresqlGenerator(host_settings='my.host.com:5432',schemas='schema_name',databases='database_name',tables='table_name')oddrn_gen.base_oddrn# //postgresql/host/my.host.com:5432oddrn_gen.available_paths# ('databases', 'schemas', 'tables', 'views', 'tables_columns', 'views_columns', 'relationships')oddrn_gen.get_data_source_oddrn()# //postgresql/host/my.host.com:5432/databases/database_nameoddrn_gen.get_oddrn_by_path("schemas")# //postgresql/host/my.host.com:5432/databases/database_name/schemas/schema_nameoddrn_gen.get_oddrn_by_path("databases")# //postgresql/host/my.host.com:5432/databases/database_nameoddrn_gen.get_oddrn_by_path("tables")# //postgresql/host/my.host.com:5432/databases/database_name/schemas/schema_name/tables/table_name# you can set or change path:oddrn_gen.set_oddrn_paths(tables="another_table_name",tables_columns="new_column_name")oddrn_gen.get_oddrn_by_path("tables_columns")# //postgresql/host/my.host.com:5432/databases/database_name/schemas/schema_name/tables/another_table_name/columns/new_column_nameoddrn_gen.set_oddrn_paths(relationships="references_table_2_with_constraint_fk")# //postgresql/host/my.host.com:5432/databases/database_name/schemas/schema_name/tables/another_table_name/relationships/references_table_2_with_constraint_fk# you can get path wih new values:oddrn_gen.get_oddrn_by_path("tables_columns",new_value="another_new_column_name")# //postgresql/host/my.host.com:5432/databases/database_name/schemas/schema_name/tables/another_table_name/columns/another_new_column_name# gluefromoddrn_generatorimportGlueGeneratoroddrn_gen=GlueGenerator(cloud_settings={'account':'acc_id','region':'reg_id'},databases='database_name',tables='table_name',columns='column_name',jobs='job_name',runs='run_name',owners='owner_name')oddrn_gen.available_paths# ('databases', 'tables', 'columns', 'owners', 'jobs', 'runs')oddrn_gen.get_oddrn_by_path("databases")# //glue/cloud/aws/account/acc_id/region/reg_id/databases/database_nameoddrn_gen.get_oddrn_by_path("tables")# //glue/cloud/aws/account/acc_id/region/reg_id/databases/database_name/tables/table_name'oddrn_gen.get_oddrn_by_path("columns")# //glue/cloud/aws/account/acc_id/region/reg_id/databases/database_name/tables/table_name/columns/column_nameoddrn_gen.get_oddrn_by_path("jobs")# //glue/cloud/aws/account/acc_id/region/reg_id/jobs/job_nameoddrn_gen.get_oddrn_by_path("runs")# //glue/cloud/aws/account/acc_id/region/reg_id/jobs/job_name/runs/run_nameoddrn_gen.get_oddrn_by_path("owners")# //glue/cloud/aws/account/acc_id/region/reg_id/owners/owner_nameExceptionsWrongPathOrderException - raises when trying set path that depends on another pathfromoddrn_generatorimportPostgresqlGeneratoroddrn_gen=PostgresqlGenerator(host_settings='my.host.com:5432',schemas='schema_name',databases='database_name',tables_columns='column_without_table')# WrongPathOrderException: 'tables_columns' can not be without 'tables' attributeEmptyPathValueException - raises when trying to get a path that is not set upfromoddrn_generatorimportPostgresqlGeneratoroddrn_gen=PostgresqlGenerator(host_settings='my.host.com:5432',schemas='schema_name',databases='database_name',)oddrn_gen.get_oddrn_by_path("tables")# EmptyPathValueException: Path 'tables' is not set upPathDoestExistException - raises when trying to get not existing oddrn pathfromoddrn_generatorimportPostgresqlGeneratoroddrn_gen=PostgresqlGenerator(host_settings='my.host.com:5432',schemas='schema_name',databases='database_name',)oddrn_gen.get_oddrn_by_path("jobs")# PathDoestExistException: Path 'jobs' doesn't exist in generatorDevelopment#Install dependenciespoetryinstall#Activate shellpoetryshell# Run testspytesttests/