Tweak to load, starting to migrate to denormalized JSON
This commit is contained in:
		
							parent
							
								
									b4ab8cbd1e
								
							
						
					
					
						commit
						befc9319fc
					
				
					 2 changed files with 11 additions and 3 deletions
				
			
		
							
								
								
									
										11
									
								
								config.py
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								config.py
									
										
									
									
									
								
							|  | @ -20,7 +20,7 @@ class DevelopmentConfig(Config): | |||
|     TITLE = 'AKIndices (test)' | ||||
|     SECRET_KEY = os.environ.get('SECRET_KEY') or 'top secret' | ||||
|     SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ | ||||
|         'postgres://postgres@localhost/akindices' | ||||
|         'postgres://matthew@localhost/akindices' | ||||
| 
 | ||||
| 
 | ||||
| config = { | ||||
|  | @ -28,3 +28,12 @@ config = { | |||
| 
 | ||||
|     'default': DevelopmentConfig | ||||
| } | ||||
| 
 | ||||
| #  WITH x AS ( | ||||
| #     SELECT name, jsonb_array_elements(data) AS data | ||||
| #     FROM temps06 | ||||
| #     WHERE name='Anchorage') | ||||
| # SELECT d.key::INTEGER AS year, d.value AS temperatures | ||||
| # FROM x, jsonb_each(data) d | ||||
| # WHERE data->>'model'='CRU' | ||||
| # AND d.key NOT IN ('model', 'datatype', 'scenario', 'modelname', 'resolution'); | ||||
|  |  | |||
|  | @ -11,10 +11,9 @@ manager = Manager(app) | |||
| @manager.command | ||||
| def initdb(): | ||||
|     # Need to import models in order for Flask-SQLAlchemy to create them | ||||
|     from app.models import Community, Dataset, Temperature | ||||
|     from app.main.models import Community, Dataset, Temperature | ||||
|     db.create_all(app=app) | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == '__main__': | ||||
|     manager.run() | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Matthew Dillon
						Matthew Dillon