Skip to content

Commit dc7e223

Browse files
committed
Update postgre
1 parent d5040cf commit dc7e223

File tree

11 files changed

+46
-46
lines changed

11 files changed

+46
-46
lines changed

deploy_ai_search_indexes/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ snowflake = [
3737
databricks = [
3838
"text_2_sql_core[databricks]",
3939
]
40-
postgresql = [
41-
"text_2_sql_core[postgresql]",
40+
postgres = [
41+
"text_2_sql_core[postgres]",
4242
]
4343
sqlite = [
4444
"text_2_sql_core[sqlite]",

text_2_sql/.env.example

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ Text2Sql__Tsql__ConnectionString=<Tsql databaseConnectionString if using Tsql Da
2727
Text2Sql__Tsql__Database=<Tsql database if using Tsql Data Source>
2828

2929
# PostgreSQL Specific Connection Details
30-
Text2Sql__Postgresql__ConnectionString=<Postgresql databaseConnectionString if using Postgresql Data Source and a connection string>
31-
Text2Sql__Postgresql__Database=<Postgresql database if using Postgresql Data Source>
32-
Text2Sql__Postgresql__User=<Postgresql user if using Postgresql Data Source and not the connections string>
33-
Text2Sql__Postgresql__Password=<Postgresql password if using Postgresql Data Source and not the connections string>
34-
Text2Sql__Postgresql__ServerHostname=<Postgresql serverHostname if using Postgresql Data Source and not the connections string>
35-
Text2Sql__Postgresql__Port=<Postgresql port if using Postgresql Data Source and not the connections string>
30+
Text2Sql__Postgres__ConnectionString=<Postgres databaseConnectionString if using Postgres Data Source and a connection string>
31+
Text2Sql__Postgres__Database=<Postgres database if using Postgres Data Source>
32+
Text2Sql__Postgres__User=<Postgres user if using Postgres Data Source and not the connections string>
33+
Text2Sql__Postgres__Password=<Postgres password if using Postgres Data Source and not the connections string>
34+
Text2Sql__Postgres__ServerHostname=<Postgres serverHostname if using Postgres Data Source and not the connections string>
35+
Text2Sql__Postgres__Port=<Postgres port if using Postgres Data Source and not the connections string>
3636

3737
# Snowflake Specific Connection Details
3838
Text2Sql__Snowflake__User=<snowflakeUser if using Snowflake Data Source>

text_2_sql/autogen/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ snowflake = [
4242
databricks = [
4343
"text_2_sql_core[databricks]",
4444
]
45-
postgresql = [
46-
"text_2_sql_core[postgresql]",
45+
postgres = [
46+
"text_2_sql_core[postgres]",
4747
]
4848
sqlite = [
4949
"text_2_sql_core[sqlite]",

text_2_sql/data_dictionary/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ The following Databases have pre-built scripts for them:
218218
- **Databricks:** `./text_2_sql_core/data_dictionary/databricks_data_dictionary_creator.py`
219219
- **Snowflake:** `./text_2_sql_core/data_dictionary/snowflake_data_dictionary_creator.py`
220220
- **TSQL:** `./text_2_sql_core/data_dictionary/tsql_data_dictionary_creator.py`
221-
- **PostgreSQL:** `./text_2_sql_core/data_dictionary/postgresql_data_dictionary_creator.py`
221+
- **PostgreSQL:** `./text_2_sql_core/data_dictionary/postgres_data_dictionary_creator.py`
222222

223223
If there is no pre-built script for your database engine, take one of the above as a starting point and adjust it.
224224

text_2_sql/text_2_sql_core/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ databricks = [
4747
"databricks-sql-connector>=3.0.1",
4848
"pyarrow>=14.0.2,<17",
4949
]
50-
postgresql = [
50+
postgres = [
5151
"psycopg>=3.2.3",
5252
]
5353
sqlite = [

text_2_sql/text_2_sql_core/src/text_2_sql_core/connectors/factory.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ def get_database_connector():
2525
from text_2_sql_core.connectors.tsql_sql import TsqlSqlConnector
2626

2727
return TsqlSqlConnector()
28-
elif os.environ["Text2Sql__DatabaseEngine"].upper() == "POSTGRESQL":
29-
from text_2_sql_core.connectors.postgresql_sql import (
30-
PostgresqlSqlConnector,
28+
elif os.environ["Text2Sql__DatabaseEngine"].upper() == "POSTGRES":
29+
from text_2_sql_core.connectors.postgres_sql import (
30+
PostgresSqlConnector,
3131
)
3232

33-
return PostgresqlSqlConnector()
33+
return PostgresSqlConnector()
3434
elif os.environ["Text2Sql__DatabaseEngine"].upper() == "SQLITE":
3535
from text_2_sql_core.connectors.sqlite_sql import SQLiteSqlConnector
3636

text_2_sql/text_2_sql_core/src/text_2_sql_core/connectors/postgresql_sql.py renamed to text_2_sql/text_2_sql_core/src/text_2_sql_core/connectors/postgres_sql.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
from text_2_sql_core.utils.database import DatabaseEngine, DatabaseEngineSpecificFields
1111

1212

13-
class PostgresqlSqlConnector(SqlConnector):
13+
class PostgresSqlConnector(SqlConnector):
1414
def __init__(self):
1515
super().__init__()
1616

17-
self.database_engine = DatabaseEngine.POSTGRESQL
17+
self.database_engine = DatabaseEngine.POSTGRES
1818

1919
@property
2020
def engine_specific_rules(self) -> str:
@@ -67,10 +67,10 @@ async def query_execution(
6767
logging.info(f"Running query: {sql_query}")
6868
results = []
6969

70-
if "Text2Sql__Postgresql__ConnectionString" in os.environ:
71-
logging.info("Postgresql Connection string found in environment variables.")
70+
if "Text2Sql__Postgres__ConnectionString" in os.environ:
71+
logging.info("Postgres Connection string found in environment variables.")
7272

73-
p = urlparse(os.environ["Text2Sql__Postgresql__ConnectionString"])
73+
p = urlparse(os.environ["Text2Sql__Postgres__ConnectionString"])
7474

7575
postgres_connections = {
7676
"dbname": p.path[1:],
@@ -81,14 +81,14 @@ async def query_execution(
8181
}
8282
else:
8383
logging.warning(
84-
"Postgresql Connection string not found in environment variables. Using individual variables."
84+
"Postgres Connection string not found in environment variables. Using individual variables."
8585
)
8686
postgres_connections = {
87-
"dbname": os.environ["Text2Sql__Postgresql__Database"],
88-
"user": os.environ["Text2Sql__Postgresql__User"],
89-
"password": os.environ["Text2Sql__Postgresql__Password"],
90-
"port": os.environ["Text2Sql__Postgresql__Port"],
91-
"host": os.environ["Text2Sql__Postgresql__ServerHostname"],
87+
"dbname": os.environ["Text2Sql__Postgres__Database"],
88+
"user": os.environ["Text2Sql__Postgres__User"],
89+
"password": os.environ["Text2Sql__Postgres__Password"],
90+
"port": os.environ["Text2Sql__Postgres__Port"],
91+
"host": os.environ["Text2Sql__Postgres__ServerHostname"],
9292
}
9393

9494
# Establish an asynchronous connection to the PostgreSQL database

text_2_sql/text_2_sql_core/src/text_2_sql_core/data_dictionary/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ def create(
9191
data_dictionary_creator = TsqlDataDictionaryCreator(
9292
**kwargs,
9393
)
94-
elif engine == DatabaseEngine.POSTGRESQL:
95-
from text_2_sql_core.data_dictionary.postgresql_data_dictionary_creator import (
96-
PostgresqlDataDictionaryCreator,
94+
elif engine == DatabaseEngine.POSTGRES:
95+
from text_2_sql_core.data_dictionary.postgres_data_dictionary_creator import (
96+
PostgresDataDictionaryCreator,
9797
)
9898

99-
data_dictionary_creator = PostgresqlDataDictionaryCreator(
99+
data_dictionary_creator = PostgresDataDictionaryCreator(
100100
**kwargs,
101101
)
102102
else:
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
import os
99

1010
from text_2_sql_core.utils.database import DatabaseEngine
11-
from text_2_sql_core.connectors.postgresql_sql import PostgresqlSqlConnector
11+
from text_2_sql_core.connectors.postgres_sql import PostgresSqlConnector
1212

1313

14-
class PostgresqlDataDictionaryCreator(DataDictionaryCreator):
14+
class PostgresDataDictionaryCreator(DataDictionaryCreator):
1515
def __init__(self, **kwargs):
1616
"""A method to initialize the DataDictionaryCreator class."""
1717
excluded_schemas = ["information_schema", "pg_catalog"]
1818
super().__init__(excluded_schemas=excluded_schemas, **kwargs)
1919

20-
self.database = os.environ["Text2Sql__Postgresql__Database"]
21-
self.database_engine = DatabaseEngine.POSTGRESQL
20+
self.database = os.environ["Text2Sql__Postgres__Database"]
21+
self.database_engine = DatabaseEngine.POSTGRES
2222

23-
self.sql_connector = PostgresqlSqlConnector()
23+
self.sql_connector = PostgresSqlConnector()
2424

2525
@property
2626
def extract_table_entities_sql_query(self) -> str:
@@ -116,5 +116,5 @@ def extract_entity_relationships_sql_query(self) -> str:
116116

117117

118118
if __name__ == "__main__":
119-
data_dictionary_creator = PostgresqlDataDictionaryCreator()
119+
data_dictionary_creator = PostgresDataDictionaryCreator()
120120
asyncio.run(data_dictionary_creator.create_data_dictionary())

text_2_sql/text_2_sql_core/src/text_2_sql_core/utils/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class DatabaseEngine(StrEnum):
77
DATABRICKS = "DATABRICKS"
88
SNOWFLAKE = "SNOWFLAKE"
99
TSQL = "TSQL"
10-
POSTGRESQL = "POSTGRESQL"
10+
POSTGRES = "POSTGRES"
1111
SQLITE = "SQLITE"
1212

1313

0 commit comments

Comments
 (0)