You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":".kokoro","path":".kokoro","contentType":"directory"},{"name":"google","path":"google","contentType":"directory"},{"name":"samples","path":"samples","contentType":"directory"},{"name":"test","path":"test","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"BENCHMARKS.md","path":"BENCHMARKS.md","contentType":"file"},{"name":"CHANGELOG.md","path":"CHANGELOG.md","contentType":"file"},{"name":"CODE_OF_CONDUCT.md","path":"CODE_OF_CONDUCT.md","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.rst","path":"README.rst","contentType":"file"},{"name":"SECURITY.md","path":"SECURITY.md","contentType":"file"},{"name":"create_test_config.py","path":"create_test_config.py","contentType":"file"},{"name":"create_test_database.py","path":"create_test_database.py","contentType":"file"},{"name":"drop_test_database.py","path":"drop_test_database.py","contentType":"file"},{"name":"migration_test_cleanup.py","path":"migration_test_cleanup.py","contentType":"file"},{"name":"noxfile.py","path":"noxfile.py","contentType":"file"},{"name":"renovate.json","path":"renovate.json","contentType":"file"},{"name":"requirements.in","path":"requirements.in","contentType":"file"},{"name":"requirements.txt","path":"requirements.txt","contentType":"file"},{"name":"setup.cfg","path":"setup.cfg","contentType":"file"},{"name":"setup.py","path":"setup.py","contentType":"file"},{"name":"test_migration_env.py","path":"test_migration_env.py","contentType":"file"}],"totalCount":24}},"fileTreeProcessingTime":2.500035,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":335511641,"defaultBranch":"main","name":"python-spanner-sqlalchemy","ownerLogin":"googleapis","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2021-02-03T04:56:07.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/16785467?v=4","public":true,"private":false,"isOrgOwned":true},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"main","listCacheKey":"v0:1750409431.0","canEdit":false,"refType":"branch","currentOid":"4a6d9656d5de0619fcc984e300edf95184f1a02b"},"path":"drop_test_database.py","currentUser":null,"blob":{"rawLines":["# -*- coding: utf-8 -*-","#","# Copyright 2021 Google LLC","#","# Licensed under the Apache License, Version 2.0 (the \"License\");","# you may not use this file except in compliance with the License.","# You may obtain a copy of the License at","#","# https://www.apache.org/licenses/LICENSE-2.0","#","# Unless required by applicable law or agreed to in writing, software","# distributed under the License is distributed on an \"AS IS\" BASIS,","# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.","# See the License for the specific language governing permissions and","# limitations under the License.","","import configparser","import os","import re","import time","","from create_test_config import set_test_config","from google.api_core import datetime_helpers","from google.api_core.exceptions import AlreadyExists, ResourceExhausted","from google.cloud.spanner_v1 import Client","from google.cloud.spanner_v1.instance import Instance","from google.cloud.spanner_v1.database import Database","","","USE_EMULATOR = os.getenv(\"SPANNER_EMULATOR_HOST\") is not None","","PROJECT = os.getenv("," \"GOOGLE_CLOUD_PROJECT\","," os.getenv(\"PROJECT_ID\", \"emulator-test-project\"),",")","CLIENT = None","","if USE_EMULATOR:"," from google.auth.credentials import AnonymousCredentials",""," CLIENT = Client(project=PROJECT, credentials=AnonymousCredentials())","else:"," CLIENT = Client(project=PROJECT)","","","def delete_test_database():"," \"\"\"Delete the currently configured test database.\"\"\""," config = configparser.ConfigParser()"," if os.path.exists(\"test.cfg\"):"," config.read(\"test.cfg\")"," else:"," config.read(\"setup.cfg\")"," db_url = config.get(\"db\", \"default\")",""," instance_id = re.findall(r\"instances(.*?)databases\", db_url)"," database_id = re.findall(r\"databases(.*?)$\", db_url)",""," instance = CLIENT.instance("," instance_id=\"\".join(instance_id).replace(\"/\", \"\"))"," database = instance.database(\"\".join(database_id).replace(\"/\", \"\"))"," database.drop()","","delete_test_database()"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/googleapis/python-spanner-sqlalchemy/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"drop_test_database.py","displayUrl":"https://github.com/googleapis/python-spanner-sqlalchemy/blob/main/drop_test_database.py?raw=true","headerInfo":{"blobSize":"1.91 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"3f2b25c","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-spanner-sqlalchemy%2Fblob%2Fmain%2Fdrop_test_database.py","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"63","truncatedSloc":"51"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Python","languageID":303,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/googleapis/python-spanner-sqlalchemy/blob/main/drop_test_database.py","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/googleapis/python-spanner-sqlalchemy/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/googleapis/python-spanner-sqlalchemy/raw/refs/heads/main/drop_test_database.py","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/googleapis/python-spanner-sqlalchemy/branches":{"post":"odG5pmOhIxTozP4JH21PMAJSHymMpPl7Hj4Esn7Sq1p9UIe88nX2O5MsamwUImzqjYeIbDqqI1VvWJB14Vm1Tw"},"/repos/preferences":{"post":"zc7YMTg3U_hVPV6jtugVisDNqBaN-cRTLRhA3FIbxGCldYm6fE8wdSaj0rxGzMuWAU-whcm2bwDZQDfB3TOnLw"}}},"title":"python-spanner-sqlalchemy/drop_test_database.py at main · googleapis/python-spanner-sqlalchemy","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1b17b3e7786a.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}