@@ -109,7 +109,6 @@ def __init__(
109109
110110 async def configure (self , force : bool = False ) -> None :
111111 """Generate Hasura metadata and apply to instance with credentials from `hasura` config section."""
112-
113112 # TODO: Validate during config parsing
114113 if self ._database_config .schema_name != DEFAULT_POSTGRES_SCHEMA :
115114 raise ConfigurationError ('Hasura integration requires `schema_name` to be `public`' )
@@ -141,8 +140,8 @@ async def configure(self, force: bool = False) -> None:
141140 source ['tables' ] = await self ._generate_source_tables_metadata ()
142141
143142 # NOTE: Don't forget to invalidate old queries, customization will fail otherwise.
144- source ['query_collections' ] = []
145- source ['rest_endpoints' ] = []
143+ metadata ['query_collections' ] = []
144+ metadata ['rest_endpoints' ] = []
146145
147146 await self ._replace_metadata (metadata )
148147
@@ -155,7 +154,7 @@ async def configure(self, force: bool = False) -> None:
155154 # NOTE: Generate and apply queries and REST endpoints
156155 query_collections_metadata = await self ._generate_query_collections_metadata ()
157156 self ._logger .info ('Adding %s generated and user-defined queries' , len (query_collections_metadata ))
158- source ['query_collections' ] = [
157+ metadata ['query_collections' ] = [
159158 {
160159 "name" : "allowed-queries" ,
161160 "definition" : {"queries" : query_collections_metadata },
@@ -166,7 +165,7 @@ async def configure(self, force: bool = False) -> None:
166165 self ._logger .info ('Adding %s REST endpoints' , len (query_collections_metadata ))
167166 query_names = [q ['name' ] for q in query_collections_metadata ]
168167 rest_endpoints_metadata = await self ._generate_rest_endpoints_metadata (query_names )
169- source ['rest_endpoints' ] = rest_endpoints_metadata
168+ metadata ['rest_endpoints' ] = rest_endpoints_metadata
170169
171170 await self ._replace_metadata (metadata )
172171
@@ -267,7 +266,6 @@ async def _replace_metadata(self, metadata: Dict[str, Any]) -> None:
267266 'type' : 'replace_metadata' ,
268267 'args' : {
269268 'metadata' : metadata ,
270- 'allow_inconsistent_metadata' : True ,
271269 },
272270 }
273271 await self ._hasura_request (endpoint , json )
@@ -617,10 +615,5 @@ def _format_select_permissions(self) -> Dict[str, Any]:
617615
618616 def _get_relation_source_field (self , field : RelationalFieldT ) -> str :
619617 if source_field := field .source_field :
620- name = field .model ._meta .fields_db_projection [source_field ]
621- else :
622- name = field .model_field_name + '_id'
623-
624- if self ._hasura_config .camel_case :
625- return humps .camelize (name )
626- return name
618+ return field .model ._meta .fields_db_projection [source_field ]
619+ return field .model_field_name + '_id'
0 commit comments